Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | AADSTS50011: 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 range | Microsoft 365 / Entra ID | Product documentation | |
| Registry key or OMA-URI involved | -> Not applicable for this error | ||
| Relevant service/endpoint URL | https://login.microsoftonline.com | Entra ID documentation | |
| Log line signature | code=50011 | Entra admin center > Monitoring > Sign-in logs | -> Filter by errorCode 50011 |
Log Files to Check
C:\Temp\AADSTS50011_signinlog.csv%TEMP%\msal.log
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
- 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.
- 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.
- 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.
- 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.
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.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 usingGet-MgAuditLogSignIn -Filter "status/errorCode eq 50011". Confirm no error code 50011 appears in these logs within 5 minutes of your test.