Home › Entra ID › AADSTS50011

Entra ID · AADSTS50011 · Microsoft 365 / Entra ID

Entra ID AADSTS50011 Redirect URI Mismatch Error in Microsoft 365

The error occurs when the redirect URI sent by the application does not match any registered URIs in Entra ID. Fix involves updating or adding the exact URI to the app registration.

Error Details

FactValueSourceNote
Exact error stringAADSTS50011: The redirect URI specified in the request does not match the redirect URIs configured for the application.Entra admin center > Monitoring > Sign-in logs-> Error code 50011
Affected build rangeMicrosoft 365 / Entra IDProduct documentation
Registry key or OMA-URI involved-> Not applicable for this error
Relevant service/endpoint URLhttps://login.microsoftonline.comEntra ID documentation
Log line signaturecode=50011Entra admin center > Monitoring > Sign-in logs-> Filter by errorCode 50011

Log Files to Check

What This Error Actually Means

The error code AADSTS50011 is raised by Microsoft Entra ID when an OAuth 2.0 or OpenID Connect (OIDC) authorization request includes a redirect URI that does not match any of the URIs configured for the application in the Entra admin center. This mismatch can occur due to various reasons such as differences in trailing slashes, protocol usage, port numbers, and case sensitivity. The error is prominently displayed during sign-in attempts and recorded in both browser URLs and Entra ID logs.

Affected Versions and Scope

This issue affects all builds of Microsoft 365 / Entra ID where OAuth or OIDC authentication flows are utilized by applications registered within the tenant. It impacts any application that uses these protocols for user sign-in, including web apps, single-page applications (SPA), and desktop/mobile clients. The error does not affect older versions of Office 365 or non-Microsoft identity providers.

Where To Look First: Logs and Event IDs

To diagnose this issue, start by examining the Entra ID sign-in logs available in the Microsoft Entra admin center under Monitoring > Sign-in logs. Filter these logs for entries with status 'Failure' and error code 50011 to find specific instances of AADSTS50011 errors. Additionally, look at browser console logs or msal.log files on Windows systems located at %TEMP%\msal.log for detailed authentication events from MSAL.NET applications.

Root Causes

Mismatch in Trailing Slashes

This occurs when the application sends a redirect URI with a trailing slash, but it is not registered that way in Entra ID. For example, if your app uses https://app.contoso.com/auth/ while Entra ID has only https://app.contoso.com/auth configured.

Incorrect Protocol Usage

Using HTTP instead of HTTPS for the redirect URI can cause this error since Entra ID strictly enforces secure connections unless explicitly allowed (e.g., localhost testing).

Unregistered Port Numbers or Wildcards

If your application uses a non-standard port number in its redirect URI, but that exact port is not registered with the app in Entra ID, you will encounter this error. Similarly, wildcard domains are generally unsupported except for specific scenarios.
Be cautious when modifying or adding redirect URIs as incorrect changes can break existing configurations and prevent users from signing into your application.

Fix Procedure

  1. Copy the exact redirect URI: From the browser address bar after a failed login, locate the 'redirect_uri=' parameter in the URL. Use an online tool or script to decode this value if necessary.
  2. Compare with registered URIs: In Entra admin center > App registrations > search for your application (by display name or client_id) > Authentication > Redirect URIs — ensure that the exact URI from step 1 matches one of these entries. Pay attention to case sensitivity, trailing slashes, port numbers, and protocol usage.
  3. For a quick check, you can use PowerShell cmdlets like Get-AzureADApplication -Filter "DisplayName eq 'YourAppName'" | Select-Object -ExpandProperty RedirectUris to retrieve the registered URIs programmatically.
  4. Add or modify redirect URI: If a match is not found, add the exact URI used by your application in Entra admin center > App registrations > select the app > Authentication > Add a platform (or edit existing) > type the exact URI > Save. Ensure that the URI uses HTTPS unless it's localhost for testing purposes.
  5. Update client application code: If modifying the registered URI is not feasible, change the redirect_uri parameter in your application configuration to match an already-registered URI exactly. For MSAL.js: set redirectUri in the PublicClientApplication config; for ASP.NET Core: set CallbackPath in appsettings.json under AzureAd; for MSAL.NET: set RedirectUri in the ConfidentialClientApplicationBuilder.

Error Code Variants

Code Description Distinguishing Factors
AADSTS50126 The provided value for the 'redirect_uri' does not match a registered redirect URI. Similar to AADSTS50011 but often related to multi-tenant configurations where the tenant-specific URIs are mismatched.
AADSTS70002 The provided value for 'client_id' is not valid or does not match an application registration in this directory. Indicates a client ID issue rather than a redirect URI mismatch. Check the client ID against Entra admin center > App registrations.

Verification

After implementing fixes, verify that the error no longer occurs by attempting to sign in through your application again. Ensure that the redirect returns a token without any errors. Check Entra ID sign-in logs for zero results after the successful test login using Get-MgAuditLogSignIn -Filter "status/errorCode eq 50011". Confirm no error code 50011 appears in these logs within 5 minutes of your test.

Prevention

To prevent recurrence, establish a baseline configuration that includes thorough testing and validation of redirect URIs during the application development lifecycle. Implement policies to restrict changes to registered URIs without proper review and approval processes. Regularly audit Entra ID app registrations for consistency between deployed applications and their configurations in the admin center. By following these guidelines and ensuring strict adherence to protocol standards, you can minimize the occurrence of AADSTS50011 errors and maintain a smooth user authentication experience across your Microsoft 365 / Entra ID environment.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.