gapi.auth2.getAuthInstance().isSignedIn.get() is always false when Chrome Browser has multiple accounts

别来无恙 提交于 2021-02-07 14:48:42

问题


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.

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.

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

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


回答1:


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



来源:https://stackoverflow.com/questions/49563824/gapi-auth2-getauthinstance-issignedin-get-is-always-false-when-chrome-browse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!