Google OAuth 2 authorization – Error: redirect_uri_mismatch

All QuestionsCategory: QuestionsGoogle OAuth 2 authorization – Error: redirect_uri_mismatch
SagarSagar Sharma asked 2 years ago

On the website I have registered my application, set up generated Client ID: and Client Secret to my app and tried to log in with Google. Unfortunately, I got the error message:
Error: redirect_uri_mismatch
The redirect URI in the request: did not match a registered redirect URI


What does mean this message, and how can I fix it? I use the gem omniauth-google-oauth2.

1 Answers
Best Answer
Josh PriceJosh answered 2 years ago

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 and look under 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.