facebook - what is response in FB.getLoginStatus -
to detect facebook user online/offline status use method fb.getloginstatus method. but, paramater("response") mean , come in below code snippet parameter response mean in line " fb.getloginstatus(function(response) "
fb.getloginstatus(function(response) { console.log(response); if (response.status === 'connected') { // user logged in , has authenticated // app, , response.authresponse supplies // user's id, valid access token, signed // request, , time access token // , signed request each expire var uid = response.authresponse.userid; var accesstoken = response.authresponse.accesstoken; console.log('user logged in , autenticated'); } else if (response.status === 'not_authorized') { // user logged in facebook, // has not authenticated app console.log('user logged in, not autorized'); } else { // user isn't logged in facebook. console.log('user not logged in'); } }, true);
you specifying function called when facebook api has completed retrieving response server. passes response object function specify. typical response be:
{ status: 'connected', authresponse: { accesstoken: '...', expiresin:'...', signedrequest:'...', userid:'...' } }
see facebook javascript docs more info
Comments
Post a Comment