I created a Google OAuth 2.0 ClientID
and secret
in Google Developer console
After that I tested in Google OAuth playground (https://developers.google.com/oauthplayground).
and registered ClientID
and secret
already created above and applied to Google OAuth 2.0 playground setting menu.
Some people say that after creating ClientID
/secret
they need some time for testing. So after two days I tried to test in the same conditions but the error is same redirect_uri_mismatch
.
How can I solve this?
When a user tries to login after the session id is expired, the system throws the OAuth error. Solution: Typically, clearing the browser or device cache fixes the problem.
A redirect URI, or reply URL, is the location where the authorization server sends the user once the app has been successfully authorized and granted an authorization code or access token.
As little as having a '/' at the end of your uri and not having the same '/' at the end in your code will throw it off.
Your site URL
and the Authorized redirect URIs
in developer console should be the exact match.
This kind of error occurs if one URL has www
(http://www.example.com
) and the other URL is non-www
(http://example.com
).
Other common URI mismatch are:
http://
in Authorized Redirect URIs and https://
as actual URL, or vice-versahttp://example.com/
) in Authorized Redirect URIs and not using trailing slash (http://example.com
) as actual URL, or vice-versaHere is the step-by-step procedure (with screenshots) to update the Authorized redirect URIs in Google Developer Console (For those like me who found it difficult to get to that page).
Go to https://console.developers.google.com
Select your Project
- Click on the menu icon
- Click on
API Manager
menu
- Click on
Credentials
menu. And underOAuth 2.0 Client IDs
, you will find your client name. In my case, it isWeb Client 1
. Click on it and a popup will appear where you can edit Authorized Javascript Origin and Authorized redirect URIs.
Here is a Google article on creating project and client ID.
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