Google logout using api javascript/jquery -
in web application, allow users login using auth command in api client library cannot find logout alternative google api javascript client library.
can 1 suggest how can logout of application google account??
my login code is:
var oauthurl = 'https://accounts.google.com/o/oauth2/auth?'; var validurl = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='; var scope = 'https://www.googleapis.com/auth/userinfo.profile'; var clientid = googleapi; var redirect = redirecturl; var type = 'token'; var _url = oauthurl + 'scope=' + scope + '&client_id=' + clientid + '&redirect_uri=' + redirect + '&response_type=' + type; var actoken; var tokentype; var expiresin; var user; $('#googlelogin').click(function(){ var win = window.open(_url, "windowname1", 'width=800, height=600'); var polltimer = window.setinterval(function () { if (win.document.url.indexof(redirect) != -1) { window.clearinterval(polltimer); var url = win.document.url; actoken = gup(url, 'access_token'); tokentype = gup(url, 'token_type'); expiresin = gup(url, 'expires_in'); win.close(); validatetoken(actoken); } }, 100); }); function validatetoken(token) { $.ajax({ url: validurl + token, data: null, success: function (responsetext) { getuserinfo(); }, datatype: "jsonp" }); }
do not log users out of google business relationship when sign out of application. behavior unexpected , annoying users.
you should, @ most, trying figure out how "log out" users of application. (i set in quotes, because depending on implementation, app might faking it).
if care hiding elements in ui, can set variable, e.g. signedin
, , set or unset when user hits login/logout button. if care persisting state across sessions, utilize cookie stores same value.
if want create sure person on other side of keyboard signed in user, can utilize max_auth_age
parameter on authorize
call. if set 0
, users need re-authenticate google before app gets valid token. if pair automatic session expiration (like you'd see on bank or health website), can relatively confident of identity of current user.
jquery google-app-engine google-api-js-client
No comments:
Post a Comment