400. That’s an error. Error: redirect_uri_mismatch - Google OAuth Authentication


I have registered my website on google's Oauth login using MVC C# , but when trying to login using Google, i am getting this issue

400. That’s an error. Error: redirect_uri_mismatch

Although i have updated my Authorized redirect URIs using https://console.cloud.google.com/apis/credentials?project=project_name but it didn't worked for me
google-oAuth2-Error-redirect-uri-mismatch

Not sure what is wrong


Asked by:- bhanu
1
: 21753 At:- 5/10/2017 11:46:48 AM
google-Oauth-2 MVC C#







6 Answers
profileImage Answered by:- vikas_jk

If you have eneterd correct details in https://console.cloud.google.com/apis/credentials?project=project_name , then wait for few minutes as sometime's it take time to update the details.

Also please double check your url in google console, it must be
http://yourwebsite/signin-google

2
At:- 5/10/2017 11:54:44 AM
Yes it works after waiting for some time 0
By : bhanu - at :- 5/10/2017 3:18:05 PM
thanks for accepting my answer and upvoting, happy to help 0
By : vikas_jk - at :- 9/4/2017 7:34:53 AM


profileImage Answered by:- jaya

Above answer may not work for all users so few points to consider about this issue

  1. If you're using Google+ javascript button, then you have to use postmessage instead of the actual URI,aslo you need to specify this in 2 places (if you are using the web-app-server-flow). One is in the g-signin button on the javascript. The other is in the signet authorization client in your server code.
  2. Make sure to check the protocol "http://" or "https://" as google checks protocol as well.
  3. Using trailing slash (http://example.com/) in Authorized Redirect URIs and not using trailing slash (http://example.com) as actual URL, or vice-versa
  4. Error may also occur if actual site has www and on google cloud console it is registered without www
1
At:- 9/12/2017 3:35:40 PM Updated at:- 9/12/2017 3:36:02 PM


profileImage Answered by:- vikas_jk

Replying to user_348638782

Looking at your error details "The redirect URI in the request, http://localhost:8080/GoogleApi/auth/google, does not match the ones authorized for the OAuth client." your redirect URI on google console is not correct, and you need to update it accordingly. The redirect URI (where the response is returned to) has to be registered in the APIs console, and the error is indicating that you haven't done that, or haven't done it correctly.

Go to the console for your project(https://console.developers.google.com/apis/credentials/oauthclient/160790488111-he5fn6rq0foqg05te70dk25gifeoum9s.apps.googleusercontent.com?project=160790488111) and look for API Access. You should see your client ID & secret there, along with a list of redirect URIs. If the URI you want isn't listed, click edit settings and add the URI to the list.

Or

1) Go to Google Developers Console

2) Set JavaScript origins:

3) Set Redirect URIs:

1
At:- 12/26/2017 7:30:13 AM


profileImage Answered by:- Vinnu

For me error was related to port number from my web application so solved it by

 http://localhost:20487/authorize/           //(Didn't worked)
 http://localhost/authorize/                 // (Worked)
0
At:- 11/24/2017 12:40:47 PM Updated at:- 11/24/2017 12:41:10 PM


profileImage Answered by:- user_348638782

please give me solution ,              

400. That’s an error.

Error: redirect_uri_mismatch

The redirect URI in the request, http://localhost:8080/GoogleApi/auth/google, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/apis/credentials/oauthclient/160790488111-he5fn6rq0foqg05te70dk25gifeoum9s.apps.googleusercontent.com?project=160790488111 to update the authorized redirect URIs.

0
At:- 12/26/2017 6:11:06 AM
Please check the answer of @vikas_jk replied to you, thanks 0
By : bhanu - at :- 12/29/2017 7:40:32 AM


profileImage Answered by:- sachin rathore

Unable to login with google from different computer and mobile or IP.

Only Google Login support from my computer  i don't why

please tell me the solution as soon as possible.

0
At:- 12/12/2018 8:00:46 AM
you must have provided only localhost url in the "Authorized JavaScript origins " you can find it in "https://console.cloud.google.com", select project -> select "Credentials" , then select your project name from OAuth 2.0 client ids table -> finally add valid url's. 0
By : Sam - at :- 12/13/2018 4:52:57 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use