I'm unable to get Microsoft Account authentication to work on an AspNet Core 2.1 website (I have Google authentication working).
When I click on the Microsoft Account button from the social sign in page, I eventually land on a "technical problems" error page. My web browser is Google Chrome, under Windows 10, latest updates.
In an attempt to diagnose what's going on, I installed LinkResearchTools Link Redirect Trace to try and follow the redirects that ultimately landed me on that error page. I'm not sure that's the best way to debug/trace what's happening, but it's all I could think of.
Clicking the Sign In link in the header of the website, the first redirect is:
That takes me to a "social signin" page, where I can choose either Google (which works) or MicrosoftAccount (which doesn't).
The next redirect is:
which then redirects me to:
https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.&state=StateProperties%3deyJTSUQiOiJ4LW1zLWNwaW0tcmM6ZTU1MDdhMzYtMmJjYy00Y2Y4LWFlNGEtNmVjY2VkNjU0MWZkIiwiVElEIjoiNDkwNTEwYTctNDAwYy00MjI3LThlODMtNmRhOTUxZTQyMmI1In0
which displays the error page.
Note that, buried in the final link, is an error description field (which for some reason doesn't get displayed on the error page). If I'm interpreting it correctly, it's saying I have a mismatch with the redirect_uri set in either the Azure portal, my website app, or both.
Yet I think the redirects are set consistently:
- website app, via appsettings.json: "RedirectUri": "https://localhost:44305/signin-oidc"
- Azure portal, via app properties reply url: https://localhost:44305/signin-oidc
So I'm obviously missing something somewhere. Thoughts?