سؤال

Let's say I get a valid access token from an external application that does Facebook Connect and sends me the token on GET.

Is it normal/good for me to get that token and save it in the $facebook = new Facebook(...); object? Something like:

$facebook = new Facebook(array(
    'appId'  => $this->app_id,
    'secret' => $this->app_secret,
));

$token = $facebook->getAccessToken();

if(empty($token) && isset($_REQUEST['access_token']))
    $facebook->setAccessToken($_REQUEST['access_token']);

$userID = $facebook->getUser();

if(!$userID)
{
    return false;
}

return $facebook;

And if this is OK to do, does the SDK also store this value in the SESSION or COOKIE array, or do I need to pass it to every script that requires it?

هل كانت مفيدة؟

المحلول

Found out how this works. The SDK doesn't set my SESSION when calling setAccessToken(), I have to set it manually and it will work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top