Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test Google One-tap on localhost? Getting a 403

The banner at the top of https://developers.google.com/identity/one-tap/web/overview says that while we must be on the whitelist to deploy this on a production site, we can test it out on localhost. However, when I try this, I still get a 403 Forbidden when including the embed script:

<script defer src="https://smartlock.google.com/client"></script>

I made sure that http://localhost:8000 is on my list of "Authorized JavaScript origins" in my OAuth Credential.

Is it possible to test out Google One-tap on localhost?

like image 826
Weston Avatar asked Aug 31 '18 20:08

Weston


2 Answers

In your "Authorized JavaScript origins", do not include the port (even though the help text says "If you're using a nonstandard port, you must include it in the origin URI."). Use http://localhost, not http://localhost:8000.

like image 190
Weston Avatar answered Nov 11 '22 18:11

Weston


HTTP403 means Forbidden - which is being covered in the Common Issues ...

window.location.origin does not have any port, but only protocol & hostname.

like image 24
Martin Zeitler Avatar answered Nov 11 '22 16:11

Martin Zeitler