Questions & Answers

Google identity services : "The given origin is not allowed for the given client ID"

My application is using Google to authenticate (and authorize) users. Since the Google Sign-In JavaScript platform library for web is deprecated, I'm migrating to Google Identity Services. For my frontend, I moved from the react-google-login (JS platform library based) package to the @react-oauth/google (GIS based) package and it went smoothly. But when I try to do the exact same thing for my backoffice, logging in is impossible and I get this error in the console : [GSI_LOGGER]: The given origin is not allowed for the given client ID.

Both my frontend and my backoffice were configured the same way with the previous package and both are now configured the same way too. Any idea what is causing this issue ?

2023-01-17 00:47:26
Welcome to stack please read How to Ask edit your question and include minimal reproducible example. Without seeing your code its hard to help. Without seeing your code and the error message you are getting I would guess it may be related to this
Answers(1) :

Did you double-check "Authorized JavaScript origins" and "Authorized redirect URIs" for the "OAuth 2.0 Client IDs" in the Google cloud console?

They are under "APIs & Services" -> "Credentials" -> "OAuth 2.0 Client IDs" for the particular project you're working on.

On a tangential note, I was having a problem with my origin not being accepted for sign-in with Google, and Apple. Turns out my HTML/JS had the URL with some capital letters, a la Pascal Case ( and the configuration settings for the allowed origins on the sign-in providers' servers were all lower case ( I was quite shocked that this was a problem (GoOgLe.CoM still gets you there) but adding the Pascal Case forms to the allowed origins fixed my problem. Good luck.