javascript - Unable to sign out using gapi.auth.signOut -
javascript - Unable to sign out using gapi.auth.signOut -
i integrating google social login in web app (angularjs). not able sign out user. below simplified approach -
scenario 1. first time user -
i have own button, when clicked loads page 'x'. page redirects user google login and/or app permission approval page. x returns user site. passed info logged in through google , have sign in through gapi can sign out later.
sign in can implemented in 2 ways -
gapi.auth.authorize()
immediate: true
or gapi.auth.signin()
'immediate': true
i have tried both. neither works. sec has additional disadvantage browser shows popup has been blocked.
then there sign out button, calls gapi.auth.signout()
, loads page 'y'. page y returns site, , scenario 2 triggered (read below), loads signed in page :(
scenario 2. returning user, in same browser.
using below code, first check if there google acess_token, can effort login through google.
gapi.auth.authorize({ client_id: self.googleappid, immediate: true, scope: ['https://www.googleapis.com/auth/plus.me'], cookie_policy: window.location.protocol+'//'+window.location.hostname }, function (response: any) { console.log(response); if (response.access_token) { self.googlelogin(response.access_token); } else { self.loadhome(); } });
the googlelogin loads page 'z', redirects original page. z passes me parameters in url, know have logged in through google. , go scenario 1.
the issue - if user has signed out using gapi.auth.signout
, why gapi.auth.authorize
(in scenario 2) returning access_token? how can @ sec scenario distinguish between signed in , signed out user?
i tried replacing gapi.auth.authorize
gapi.auth.signin()
in sec scenario. loads google log in page index page loaded. didn't explore further.
please allow me know going wrong , how prepare this.
javascript google-api-js-client gapi
Comments
Post a Comment