Google Auth with NodeJS getting "Not a valid origin for the client"

I’m trying to figure out the correct authorized JavaScript origin for a NodeJS app on Glitch.

My Google Cloud web app is set to:
Authorized JavaScript origins
For use with requests from a browser
URIs *
https://turtleandhare.glitch.me

My Glitch project is here: Glitch :・゚✧
and here is the front: Login

Here is the error that I’m getting when my login page loads…
“Not a valid origin for the client: https://turtleandhare.glitch.me has not been registered for client ID 88713995697-nii4pt4khb53arcbqud3gv5evkound65.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and register this origin for your project’s client ID.”
error: “idpiframe_initialization_failed”

I have tried changing the Google Cloud web app authorized URI to…

  1. Login but Google Cloud says ‘Invalid Origin: URIs must not contain a path or end with “/”.’
  2. https://turtleandhare.glitch.me:5000 which is the port that I’m using in server.js but then I get an error: ‘Authorization Error Error 400: redirect_uri_mismatch’

Thanks for your help!

1 Like

NEVERMIND!

I found this StackOverflow: javascript - idpiframe_initialization_failed in Google Sign In from Localhost - Stack Overflow

In short: clear your browser cache.

In Chrome: Settings → Advanced → Clear browsing data → Cached images and files

Cleared the cache and visited my login page again and the error was gone.

2 Likes