问题
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