谷歌api授权错误"无效的Cookie政策"

时间:2018-06-16 14:53:38

标签: javascript api google-api google-drive-api google-picker

我尝试使用Google api但这种方法

gapi.auth.authorize(
    {
        'client_id': CLIENT_ID,
        'scope': ['https://www.googleapis.com/auth/drive '],
        'immediate': true
    },
    handleAuthResult);

给我一​​个错误对象

  

{
      消息:
  " cookiePolicy无效"
  堆栈
  :
  " gapi.auth2.ExternallyVisibleError:无效的cookiePolicy
      在新的uO(https://apis.google.com//scs/apps-static//js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:351:25
      at Object。 .tY(https://apis.google.com/ /scs/apps-static/_/js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:365:246)         在Nm(https://apis.google.com//scs/apps-static//js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:368:462
      at Object。 .jH(https://apis.google.com/ /scs/apps-static/_/js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:385:55
      在https://apis.google.com//scs/apps-static//js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:641:58
      在新的 .C(https://apis.google.com/ /scs/apps-static/_/js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:82:299
      at Object。 .hx [as authorize](https://apis.google.com/ /scs/apps-static/_/js/k=oz.gapi.it.cWuXt0TFtAc.O/m=client/rt=j/sv=1/d=1/ed=1/am=QQE/rs=AGLTcCNBVmWsKdwnYSZ6gdBgYWDV40Vbng/cb=gapi.loaded_0:641:34
      at onAuthApiLoad}

我该如何解决?它应该归还Oauthtoken,谢谢。

1 个答案:

答案 0 :(得分:0)

根据这个SO post,你需要一个Web服务器来执行Goolge Pickers。首先使用Python&#39>启动您的网络服务器。

python -m SimpleHTTPServer 8080

或用于python 3.X

python -m http.server 8080

NodeJS webserver