I try to get extended long-lived access token with
$facebook->setExtendedAccessToken();
$access_token = $facebook->getAccessToken();
After looking SDK I found that setExtendedAccessToken() function is setting long-lived access token in
protected static $kSupportedKeys =
array('state', 'code', 'access_token', 'user_id');
with
$this->setPersistentData(
'access_token', $response_params['access_token']
);
and getAccessToken() is returning short-lived access token from
protected $accessToken
so what is the purpose of setExtendedAccessToken() since it does not return anything?
@Julian. Thank you so much for the inspiration here.
I was able to make this work without changing any of the core FB api files.
What happens is, the
setExtendedAccessTokencall sends the value tosetPersistentDatawhich then sends it into session viaconstructSessionVariableName.So if we get it out of session, and then set it into the facebook object, we’re all set.
Here is my code: