I have created a blank, new ASP.NET MVC site.
I have set up an application endpoint at https://account.live.com/developers/ as follows:
API Settings: http://i.imgur.com/bIoV3x9.png
App Settings and Code-Behind: http://i.imgur.com/P3KFyhV.png
I have tried launching my site, connecting to https://localhost:44300/
, clicking "Log in", then "Microsoft" and I get a page that says the following:
Microsoft account
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
But the URL it redirects me to is:
https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The%20provided%20value%20for%20the%20input%20parameter%20'redirect_uri'%20is%20not%20valid.%20The%20expected%20value%20is%20'https://login.live.com/oauth20_desktop.srf'%20or%20a%20URL%20which%20matches%20the%20redirect%20URI%20registered%20for%20this%20client%20application
I am to believe that the redirect_uri is not valid. The expected value is some URI to oauth20_desktop.srf. I don't know what in the world is going on/what the problem is. Can anyone shed some light as to what I must do to test Microsoft Account logins to my localhost-running MVC site?
Your findings are correct, Microsoft doesn't allow for localhost as redirect_uri
and it is explain in the ASP.NET Documentations...
When registering your site with Facebook, you can provide "localhost" for the site domain and "http ://localhost/" for the URL, as shown in the image below. Using localhost works with most providers, but currently does not work with the Microsoft provider. For the Microsoft provider, you must include a valid web site URL.
If you want to get it working you will need to set up an IIS site with custom host headers, this will require you to modify the hosts files in your machine...assuming you are developing on a Windows machine of course
%SystemRoot%\system32\drivers\etc
to open the path where the hosts file is located...usually C:\Windows\system32\drivers\etc
Open the hosts file as Administrator and add an entry that matches your set up host headers...
127.0.0.1 www.testsite.com
Once saved you can open a browser window to test the set up by type in http://www.testsite.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With