本文介绍了当Chrome浏览器具有多个帐户时,gapi.auth2.getAuthInstance().isSignedIn.get()始终为false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我复制了 Google Calendar API快速入门中给出的示例,并将其替换为适当的信息.每次刷新页面时,系统都会要求我在提取api数据之前进行授权.

I copied the example given in Google Calendar API Quickstart and replaced it with the appropriate info. Every time I refresh the page, I'm asked to authorize before api data is fetched.

我正在使用Chrome,目前有多个帐户/用户.我注意到是否打开隐身窗口并使用一组凭据登录,然后在刷新页面时不要求我进行授权.

I'm using Chrome and I currently have multiple accounts / users. I noticed if I open an Incognito Window and sign in with one set of credentials then when I refresh the page I'm not asked to authorize.

注意,一旦我通过身份验证,我就会收到日历信息,所以我不认为这是 client_id api_key scope 等问题

Note, once I authenticate I receive calendar information so I don't believe it's an issue with client_id, api_key, scope, etc.

看示例代码,我猜到 getAuthInstance()变得混乱,因为有多个帐户/用户.有人有什么主意吗?谢谢!

Looking at the example code, I'm guessing the getAuthInstance() is getting confused because of multiple accounts / users. Does anyone have any idea? Thanks!

推荐答案

localhost 上运行时会发生这种情况.将网页部署到托管服务器后,该问题不再发生.

This was happening when running on localhost. This issue stopped happening after deploying the webpage to a hosted server.

这篇关于当Chrome浏览器具有多个帐户时,gapi.auth2.getAuthInstance().isSignedIn.get()始终为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 23:15