AADSTS50011: The reply URL specified in the request doesn't match registered the reply URLs

Copper Contributor

Is this a common occurrence;  does anyone know how to get around this issue? 

 

"AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'my application client id'. "


I've followed the directions explicitly in these two documents, and reviewed others to see if I was missing anything.  Reviewing responses to others' issues with the same problem did not resolve the failed auth issue. 
https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-...

 

I have an Azure Web App that has been registered.  I can go to Azure Portal Home >> App registrations >> My App >> Endpoints, add all of the OAuth endpoints under the Redirect URIs and still cannot get fully logged in.  

I tried the <app-url>/.auth/login/aad/callback redirect format from one of the above articles with no success.  I've tried https://myapplicationname.azurewebsites.net/.auth/login/aad/callback, https://login.microsoftonline.com/mytenantid/oauth2/v2.0/authorize (as well as the three other endpoints with this format), https://login.microsoftonline.com/common/oauth2/v2.0/authorize (same with other three endpoints), etc. 

When I run in debug on my localhost:44321/ the web app launches, prompts for authentication, and is successful each time, however, always fails with the same subject error any time I deploy the build to Azure.  My localhost addresses are listed in the Redirect URIs, so that makes sense the local deployment is successful but I cannot figure out why the deployed web app always fails when it goes live.  I've tried everything that I could possibly think of with different combinations, but no luck getting past the auth error so any insights would be greatly appreciated. 

 

 

3 Replies

Hello @sffc-sns 

 

I have exactly the same issue, endpoints are well configured, when using localhost (http and https) it works perfectly, when deploying to production, the webapp can't login even with correct configuration for callback endpoint urls.

 

Did you found the reason?

@AllTerrainDeveloper 

 

Have you been able to solve this issue?  I'm also seeing the same thing on a test project.

Yes, Just add:

 

app.UseForwardedHeaders(new ForwardedHeaderOptions { ForwardedHeaders =  ForwardedHeaders.XForwardedProto });

 

 @Krinjeck