cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Google Login Redirect URI mismatch issue

Former Member
0 Likes
1,407

I'm trying to integrate Google Login in my application. I'm following this documentation : https://developers.google.com/identity/sign-in/web/server-side-flow

According to this doc, we need to include Gapi to our script to get 'oneTimeCode' from Google server upon button click event. I am able to get oneTimeCode , by creating a Google Web client in console.developers.google.com. We'll have to pass this oneTimeCode to our Back-end, so that our Back-end exchanges this oneTimeCode with Access tokens from Google (using GoogleAuthorizationCodeTokenRequest API). I'm trying to integrate Google Login from my localhost accelerator. While doing so I'm getting a 'Redirect URI' mismatch error, even after registering a redirect URI in my web app. Attached error below:

com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "redirect_uri_mismatch", "error_description" : "Bad Request" }

any help is greatly appreciated!

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Likes

Hi, I resolved the issue. The reason is implicit google service requirements. The redirect_uri, which you send to google service (I am using GoogleAuthorizationCodeFlow), shouldn't be equal redirect_uri, which is set in that Auth client ID credentials record (google service). It should be equal that URI, which is marked as 'For use with requests from a browser' if there are several URIs, select that one, which sends an authCode to your backend.