react-oauth icon indicating copy to clipboard operation
react-oauth copied to clipboard

Given Origin is not allowed for the given client ID

Open yjtan118 opened this issue 2 years ago • 11 comments

Hi, I have checked through some of the earlier issues around the same topic, but I'm still getting the above error.

I have tried putting both server url and url with port number in the Google Authorized Origin, but it doesn't work for me.

However, localhost works though.

OAuth2 consent form has been filled up as well. Any hints on what else could be causing this error?

yjtan118 avatar Mar 28 '23 14:03 yjtan118

Could be something to do with the referral-policy given that the server url is http and not https. What do I need to do to set the referral-policy to no-referrer-when-downgrade?

yjtan118 avatar Mar 28 '23 15:03 yjtan118

I'm facing the same issue but in localhost, any idea? I already have configured http://localhost/ and http://localhost:3000/ in the Google Cloud console...

dcalap avatar Apr 05 '23 12:04 dcalap

i ended up solving this by upgrading to https in all the servers...google will even detect that some servers in the entire request are not on https

yjtan118 avatar Apr 05 '23 13:04 yjtan118

Could be something to do with the referral-policy given that the server url is http and not https. What do I need to do to set the referral-policy to no-referrer-when-downgrade?

Same issue here. Not sure why.

hli0509 avatar Apr 24 '23 03:04 hli0509

Is there any solution for localhost?

kkan0615 avatar Sep 11 '23 01:09 kkan0615

I'm going through the same issue right now

kaiomagalhaes avatar Sep 11 '23 12:09 kaiomagalhaes

@kkan0615 the issue for me was that localhost wasn't added on the javascript allowed origins in google admin

kaiomagalhaes avatar Sep 11 '23 13:09 kaiomagalhaes

@kaiomagalhaes Thank you for sharing your solution 👍

kkan0615 avatar Sep 16 '23 03:09 kkan0615

I have my configuration in the google console of my test server but without an ssl certificate,

http://epint.mutualseg.cl/ and when I try to log in it shows me this error in the console: m=credential_button_library:49 [GSI_LOGGER]: The given origin is not allowed for the given client ID.

Now with the configuration for my http://localhost:3000 it works.

What could be happening?

jorendon avatar Feb 05 '24 15:02 jorendon

@kkan0615 the issue for me was that localhost wasn't added on the javascript allowed origins in google admin

Authorized JavaScript origins For use with requests from a browser URIs 1 https://example.com URIs 2 http://localhost:3000

My set up is this in the Google Cloud console. It fails to work because when I click on the button in development, the modal opens to a blank and I get "The given origin is not allowed for the given client" in the console.

How did you solve this part?

Btw, it works in production only in Firefox and not in Chrome. In Firefox, the modal opens and I get options for Google Accounts.

doverradio avatar Jun 19 '24 00:06 doverradio

@kkan0615 the issue for me was that localhost wasn't added on the javascript allowed origins in google admin

This worked for me. I already had http://localhost:5173 configured but I also had to add http://locahost and then it worked

zjgoodman avatar Jul 29 '24 19:07 zjgoodman