Today I faced an issue with Azure Active Directory authentication that was interesting enough to not this down for later reference 😁.
I’ve got this issue in our (new) web application:
With the help from this blogpost from Antti I’ve learned that the url you’ve entered to redirect to after the authentication is done, has to match exactly with the URL you send in with the Authentication Request itself.
To verify your own setup, go to the App Registration Setup and find the URL you are using.
I my case, we where using OpenIdConnect middleware that listens on a specific url for the callback that you can specify yourself (so you can match it with the App Registration). To make it clear where we are coming from, I’m using
In the image below you can find the place where we configure this callback path (we load it from the configuration here). Do note that the middleware doesn’t want the root path here, so
/signin-microsoft will do the trick in this case.