문제

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