I am trying to integrate the google-one-tap with my django project on my localhost.
So I added http://localhost:8000
and http://localhost
into the Authorized JavaScript origins in Client ID for Web application.
I read some blogs that the above setting does work for the google-one-tap local testing, but it doesn't work for me.
-
I am in the same boat and wanted to tell you that your setup is correct. There were recent changes that are "perhaps" preventing usage of "localhost" as origin. When the service was only called "Sign-In" we were able to use "localhost" as origin but not "127.0.0.1". – victor n. Aug 29 '21 at 16:27
4 Answers
Answer provided here worked for me: The given origin is not allowed for the given client ID (GSI)
As ridiculous as it seems omitting the port and writing http://localhost
as JavaScript origin makes the new Google Identity Services code work.
Now my next question is how this change will affect the redirect url, which also accepted a port before.

- 658
- 1
- 7
- 14
I finally found out the solution.
It should be set the SECURE_REFERRER_POLICY in the settings.py like this.
SECURE_REFERRER_POLICY = "no-referrer-when-downgrade"

- 1,441
- 12
- 24
The setup is correct according to the setup instructions here.
Aside from following the above document, please also make sure you are sending the requests from the correct origin. In your case it should be from http://localhost:8000. Please also double check to see if the HTTP headers and parameters in the request also match the authorized origins.
Would you be able to find out which request failed from the web console?

- 1
- 1
-
Please add further details to expand on your answer, such as working code or documentation citations. – Community Sep 03 '21 at 00:19
Add both http://localhost
and http://localhost:<port_number>
to the Authorized JavaScript origins box for local tests or development
. Read more

- 393
- 4
- 6