Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy

I'm trying to add a Google Sign In Authentication system to my app, but I keep getting a strange error that I haven't seen anyone get. I'm using EXACTLY the google example code.

I thought it could be some mistake when loading the api, so I checked the async loading and everything seems to be loading properly, but I keep getting this error in the console:

gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy

I searched everywhere for people with the same problem, but I could not find anything similar.

Any ideas?

EDIT: I tried to create a page with ONLY the code of the tutorial, but the error still occurs.

like image 319
KoJoVe Avatar asked Oct 01 '15 20:10

KoJoVe


3 Answers

Well, turns out I was trying to test the API by directly acessing my files locally (index.html). The Google Sign In API only works in a running web server. I started a simple node.js server, ran my app trhough this server, and everthing worked just fine.

like image 197
KoJoVe Avatar answered Nov 16 '22 04:11

KoJoVe


As already answered by KoJoVe, you need to run inside a web server. If you are using Python 2.7 you might use python -m SimpleHTTPServer 8000 and then use localhost:8000 on your browser

like image 8
Shreyas Gaonkar Avatar answered Nov 16 '22 02:11

Shreyas Gaonkar


I've been trying to get a chrome extension to work for a very long time, and I recently decided to click into the error. The reason is because the google platform script checks window.location.protocol (which isn't https for chrome extension) and throws the error 'invalid cookie policy'.

My theory as to why Google won't fix this:

  1. They want to drive people into using paid OAuth2 endpoints

  2. They want to know who received the tokens, if possible (via certificate authorities)

like image 4
neaumusic Avatar answered Nov 16 '22 02:11

neaumusic