gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy

前端 未结 4 1457
执念已碎
执念已碎 2020-12-05 22:28

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 exampl

相关标签:
4条回答
  • 2020-12-05 23:00

    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

    0 讨论(0)
  • 2020-12-05 23:15

    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)

    0 讨论(0)
  • 2020-12-05 23:20

    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.

    0 讨论(0)
  • 2020-12-05 23:22

    This worked in my case with python 3:

    open python terminal and write the following code:

    from http.server import SimpleHTTPRequestHandler as handler
    import socketserver as socket
    httpd = socket.TCPServer(("",8000),handler)
    httpd.serve_forever()
    
    0 讨论(0)
提交回复
热议问题