How to sign out a user after page refresh?
问题 I'm following Google's guide to sign out a user. Considering that gapi.auth2 will be undefined after refreshing the page, I'm doing: if (gapi.auth2) { var auth2 = gapi.auth2.getAuthInstance(); auth2.signOut(); } else { gapi.load('auth2', function () { gapi.auth2.init({ client_id: 'myAppID', cookiepolicy: 'single_host_origin' }).signOut(); }); } But I get uncaught exception: This method can only be invoked after the token manager is started in the else block. I also have tried to store the