javascript - Make google auth request gapi.auth without a popup -
need make auth request in js browser not support popups. there way redirect new url or show request in in html5 page of application
by using code check if user authorized app
gapi.auth.authorize({client_id: clientid, scope: scopes, immediate: true}, callbackauthresult);
note: immediate:true
if set immediate true wont show popup.
you see? don't open popup, , manage stuff in callback. callback used post-processes. here use authenticating.
in callbackauthresult
:
callbackauthresult = function (authresult) { var authorizebutton = document.getelementbyid('authorize-button'); if (authresult && !authresult.error) { authorizebutton.style.display = 'none'; // processing here } else { authorizebutton.style.display = 'block'; authorizebutton.onclick = callbackauthclick; } } callbackauthclick = function (event) { gapi.auth.authorize({ client_id: clientid, scope: scopes, immediate: false }, handleauthresult); return false; }
Comments
Post a Comment