javascript - How to detect Google+ user logged in -
i've added basic code google+ api docs.
function onsignin(googleuser) { var profile = googleuser.getbasicprofile(); gapi.auth.checksessionstate({session_state: null}, function(isusernotloggedin){ if (isusernotloggedin) { console.log('not logged in'); } else { console.log('logged in'); } }); /* console.log('id: ' + profile.getid()); // not send backend! use id token instead. console.log('name: ' + profile.getname()); console.log('image url: ' + profile.getimageurl()); console.log('email: ' + profile.getemail()); */ var id_token = googleuser.getauthresponse().id_token; //console.log("id token: " + id_token); $.post('login.asp', 'idtoken=' + id_token, function(data){ //console.log('passato login.asp, idtoken=' + data); }); }
i see it's not way use it, how can check if user logged in or not, in order let him access authenticated user features?
Comments
Post a Comment