Facebook token in relation with Session

Viewed 484

I have this function for facebook

public function link2(){
        global $config;
        $facebook = new Facebook(array(
              'appId'  => $config['facebook_appId'],
              'secret' => $config['facebook_secret'],
              'cookie' => true
        ));
        return $facebook;
    }

then I do this to get the token

if(isset($_SESSION['fb_'.$config['facebook_appId'].'_access_token'])){
            $accesstoken = $_SESSION['fb_'.$config['facebook_appId'].'_access_token'];
        }else{
            $accesstoken = $facebook->getAccessToken();
        }

and store it in DB, but after I logout and login again and make another call for ALBUMS I get error

A user access token is required to request this resource

i am doing session_destroy in my logout.php file, I am wondering how session is related to this , If i change my logout.php file to just unset userId variable then call works for me. Am I missing something?

4 Answers
Related