3

I just want to know if there is a naming standard on REDIRECT URIS for : Twitter, LinkedIn, Microsoft, Facebook and Google when using OAuth 2.0?

Because, if I write my domain like that : http://domain.com/account/external-signin.aspx every external login stop working except Twitter and Facebook. The name account/external-signin.aspx is the real URL I'm working with and that I'm supposed to give to every external login.

So, Microsoft give this error: We're unable to complete your request Microsoft account is experiencing technical problems. Please try again later.

LinkedIn: Invalid redirect_uri. This value must match a URL registered with the API Key.

And Google 400. That’s an error. Error: redirect_uri_mismatch

If I remove the page extension .aspx it seems to work although I deliberately write a wrong url like http://domain.com/sign-google, http://domain.com/sign-microsoft etc...

I'm working with MVC5 and C#.

I think I missed a few things ...

Thanks for your help

Karine
  • 385
  • 1
  • 7
  • 18

3 Answers3

2

So finally, here is the correct answer:

It's not you that choose the redirect URL. You must write your domain.com/signin-{suppliername} in your app management.

Example:

  1. Microsoft : https://domain.com/signin-microsoft
  2. LinkedIn : https://domain.com/signin-linkedin
  3. Google : https://domain.com/signin-google

Facebook and Twitter can work with your own redirect URL. Once successfully registered, the effect is immediate. Hope this can help somebody.

Karine

Karine
  • 385
  • 1
  • 7
  • 18
  • I'm having same problem... I didn't undestand how to create a valid redirect URI for Google when working in development environment on localhost with IIS Express. The problem is that my URIs are like: http(or s)://localhost:123/Page etc. So there's a port number. And everytime I run the application and try the Google login, I get the "invalid redirect uri" error on a different port... http://localhost:456/authorize, then http://localhost:547/authorize, then http://localhost:985/authorize and so on... So, how can I set a valid redirect uri on my Google Developer Console using IIS Express? – Cheshire Cat Mar 10 '15 at 16:11
1

This error is denoting that you're having a miss match with the URL you're returning, and the return URL registered at the API Server. When you register your application, at the server, (for Google: https://code.google.com/apis/console) you have to make sure that the URLs being used would be matching.

After this, you will not get this error, I think on the server you've set this property to, http://domain.com/account/external-signin (without aspx; as you've said that this works without the extension but not with it). So try to change it on the server too.

Afzaal Ahmad Zeeshan
  • 15,669
  • 12
  • 55
  • 103
  • The first time I had added signin-google, signin-microsoft and later I switch to account/external-signin.aspx for every one. I think Google, Microsoft and LinkedIn are not refreshing because Google talk about the signin-google URL in the error message... What do you think? – Karine Sep 11 '14 at 15:21
  • Yes, your URLs must match in the API console. – Afzaal Ahmad Zeeshan Sep 11 '14 at 15:28
  • Urls are matching perfectly and I have the same problem. I just found http://stackoverflow.com/questions/11485271/google-oauth-2-authorization-error-redirect-uri-mismatch. The comment from user984621 explain he had to wait one hour before Google make the change. So I will wait and I will comment again if It was the problem. – Karine Sep 11 '14 at 18:06
  • Oh, might be problem with the servers then, ;-) – Afzaal Ahmad Zeeshan Sep 11 '14 at 18:07
  • What I don't understand is why my URL assignation is not the one taken by google... Even If I have to wait I don't understand that point :( By example: var properties = new AuthenticationProperties() { RedirectUri = ".../account/external-signin.aspx"}; is transform to ".../signin-google" grrr! – Karine Sep 11 '14 at 19:03
1

For Linkedin append your url with "signin-linkedin".e.g. if your url is http://localhost:{portnumber}, make sure its is register in linked in as "http://localhost:{portnumber}/signin-linkedin" and this will do the trick.

Happy Codding :)

SubratKP
  • 49
  • 1
  • 8