MVC OAUTH VS2012 template VB.Net
I'm adding OAuth so that my users can login via Facebook etc. I have entered my clientSecret and ClientID in the RegisterAuth function. When I run the code I get:-
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."
I have searched everywhere to find where I enter the URL. I think it is defaulting "/Account/ExternalLoginCallback" but that would be of no use to the external Authorisor.
I think it's going to be obvious but I just don't see it !
thanks John
Lukos' answer is good, but in ASP.NET MVC 5 I believe the default URL redirect has changed.
With MVC 5 (with the help of fiddler) I see we need to use: (Of course substitute mysite with your site name)
Root domain:
www.mysite.com
Redirect URLs:
http://www.mysite.com/signin-microsoft
Note the required "/signin-microsoft" at the end of the Redirect URL.
If this still does not work for you use fiddler and look at the POST coming from /Account/Login and in the Response Headers find the redirect_uri value.
The redirect_uri is added to the identity provider when you register your account with them. This happens so that when you redirect to their site to login, it knows where to redirect back to after authentication occurs.
The URI is generally always required at registration to avoid people changing it and using it in a phishing web site to piggy-back your account. The path you stated is correct for ASP.net MVC (it is different for web forms) but will need to be absolute so that the provider can redirect. Something like this:
http://www.mysite.com/Account/ExternalLoginCallback
Note that some providers (definitely Google) will not permit this url to be localhost which you might want to use when testing a site locally. If you need to do this, you can create a hosts entry locally that points www.something.com to localhost and then register the url at your provider with www.something.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