Google oauth error 400 redirect_uri_mismatch for the domain itself

I’ve set up social login with google using the “Google” plugin. It works in the development version, but not in the live version. The URL I’m clicking a log-in button from is the domain root itself (let’s call it https://mydomain.com). If I understand correctly the plugin sends the current URL as the redirect URI parameter with my request to google. In google cloud platform console I’ve set up as authorized redirect URIs 4 items:
https://mydomain.com
https://mydomain.com/
https://mydomain.com/version-test
https://mydomain.com/version-test/
I can sign in from https://mydomain.com/version-test but not from https://mydomain.com and I can’t figure out what’s missing.

I usually have issues with this, and it comes from the workflow action in which I use Navigate to external website to open the google login screen, which the URL in that navigation requires the redirect URI as well as needing the redirect URI in your google dashboard.

Sometimes, I end up having to ‘hard code’ the value rather than relying on the dynamic expression of website home url.

Why do you have to go to an external website to open the google login screen? is that so the plugin would set that URI as the redirect URI in the request?

Oh, sorry, I didn’t realize you were using the plugin. I just use the API, so for that I need to navigate to the google page. I suppose the plugin has that built into it.

I see. Maybe I’ll end up switching to the API too if I don’t find an answer :slight_smile:
thanks

I was able to make it work just now with the Google plugin.

I only added 1 Authorized redirect URI in google cloud : the one shown between parenthesis in the plugin settings (see image below).

Login works both on development and production versions of my site.

2 Likes

Eventually, there was a typo in the allowed URLs…
thanks for your help guys

1 Like

@demondragong 's post worked for me!

1 Like