azureauthenticationazure-devops

AADSTS50011: The redirect URI specified in the request does not match the redirect URIs configured for the app


When trying to sign into my C# .NET app, I get the following error:

AADSTS50011: The redirect URI 'https://prostrideskating-dev.azurewebsites.net/signin-oidc' specified in the request does not match the redirect URIs configured for the application {client id}. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

When I go to the App Registration, it looks like it already has the redirect uri that it claims its missing (see image below). Not sure what I'm doing wrong here.

Web Redirect URIs

Implicit grant and hybrid flows

I tried to follow the steps with https://aka.ms/redirectUriMismatchError, but the redirect uri that it claims doesn't match does appear to match. The base uri for the https://prostrideskating-dev.azurewebsites.net/.

I recently updated the Service Principal for the application, so I'm not sure if that would affect it or not. I use a different app registration for the service principal than I do for the redirect.

I am expecting to be able to login when I click "sign in". Oddly enough, it works on my live site, but not my test site even though they both use the same app registration for both the service principal and the redirect.


Solution

  • You have this configured:

    https://prostrideskating.azurewebsites.net/signin-oidc
    

    But not this:

    https://prostrideskating-dev.azurewebsites.net/signin-oidc
    

    Note the different subdomain. Add the second one to your redirect URIs.