3

I'm throwing together a simple POC for a client that wants to use LiveId (now Microsoft Account or MSA) for users to sign in. I've done this with FaceBook, Google and Twitter and they were all a walk in the park. For whatever reason MSA is a royal PITA.

I've created a MVC5 application using Visual Studio 2015. I went to the MSA developer center to create my app and get the client id and secret. The redirect URL I'm using is http://localtest.me/membersweb/signin-microsoft The client id and secret go in Start.Auth.cs just like usual.

I've setup IIS and have my app in a virtual directory. When I run my application it comes up like usual. I click Log In and it goes to the login page as expected and the Microsoft button appears in the right hand column as expected. When you click the Microsoft button you are redirected to the MSA sign in page. B/c I'm already signed in I should be taken to the authorization page where I give my application permission to access my info. Instead I'm taken to an error page. The title says "We're unable to complete your request" and the rest of the message says "Microsoft account is experiencing technical problems. Please try again later.". Pretty useless. The url is a tiny bit more helpful with the following error message: 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.

This isn't rocket science. I do this w/ FaceBook all the time. What the blazes am I doing wrong?

No other coding, configuring or customization has been performed.

TIA

Jake
  • 906
  • 10
  • 23

2 Answers2

4
  • Go to https://account.live.com/developers/applications
  • Choose your application
  • Go to Edit Settings
  • Go to API Settings
  • Edit the Redirect URLs: add "/signin-microsoft" to the end of your redirect_uri
  • Go to your code and set the same redirect_uri for the API call
  • Go to drink a beer or two or more

This worked for me :)

PS: If it is still not working, try to add "/Account/ExternalLoginCallback" at the end of your redirect_uri, but this is not confirmed as working solution

For more info here: http://www.benday.com/2014/02/25/walkthrough-asp-net-mvc-identity-with-microsoft-account-authentication/

tsveti_iko
  • 6,834
  • 3
  • 47
  • 39
0

In case anyone is having this problem.... I ran into this issue recently and adding "/signin-microsof" or "/Account/ExternalLoginCallback" did not help.

What I ended up doing is adding the following redirect URIs to all app registrations (Microsoft, Google and Facebook in my case).

https://YOUR-DOMAIN.b2clogin.com/YOUR-DOMAIN.onmicrosoft.com/oauth2/authresp
https://login.microsoftonline.com/te/YOUR-DOMAIN.onmicrosoft.com/oauth2/authresp

gabics
  • 250
  • 1
  • 14