Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
640 views
in Technique[技术] by (71.8m points)

reactjs - Google Sign-In: Not a valid origin for the client: http://localhost:3000 has not been whitelisted for client ID XXXXXXXXXXXX

This question has been asked before here, but it wasn't detailed and there is no answer yet. So I am posting it here again.

I am trying to implement Google-sign in.
First, I have to test it in local host, before pushing to prod.
The problem is that in the console, it logs this error as soon as the login page is loaded, without me clicking anything:

"Not a valid origin for the client: http://localhost:3000 has not been whitelisted for client ID XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."

I have added localhost:3000 in authorized javascript origins:
enter image description here
However, I am not sure this is exactly what they mean by "whitelisting http://localhost:3000 for client ID.


NOTE: Before adding localhost:3000 in authorized javascript origins, when I click on the sign-in button, this window gets displayed:

enter image description here

After adding it, that window succesfully displays the google accounts that I can use to sign-in.
So I guess whitelisting and adding to authorized javascript origins are two different things?

question from:https://stackoverflow.com/questions/65869839/google-sign-in-not-a-valid-origin-for-the-client-http-localhost3000-has-not

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Whitelisting is simply the opposite of blacklisting. A whitelist is a list of people who are authorized to access your program. You need to whitelist yourself to give yourself access your program and prevent others from taking advantage of your program since it is still in progress and thus vulnerable. You want to whitelist your Ip address which whitelists your localhost. You can find your ip address by typing "my ip" in google.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...