Yii2刷新facebook访问令牌

时间:2015-02-07 14:59:28

标签: facebook facebook-graph-api yii2

我正在使用下一代码在yii2

中发布到用户墙
        $client = Yii::$app->get('authClientCollection')->getClient('facebook');    
        $access_token  = new Facebook();
        $access_token->clientId = $client->clientId;
        $access_token->clientSecret = $client->clientSecret;
   $session = new FacebookSession($access_token->accessToken);
   if ($session) {
       try {
           $response = (new FacebookRequest(
                   $session, 'POST', '/me/feed', array(
               'link' => 'test link',
               'message' => 'message here'
                   )
                   ))->execute()->getGraphObject();

           echo "Posted with id: " . $response->getProperty('id');
       } catch (FacebookRequestException $e) {
           echo "Exception occured, code: " . $e->getCode();
           echo " with message: " . $e->getMessage();
       }
   }

但是我遇到的问题是我没有找到任何方法来扩展访问令牌并使用' yii2 auth客户端类'来刷新它。或者' facebook sdk' ,任何想法,请。

1 个答案:

答案 0 :(得分:0)

如果找不到Facebook会话,请查看sdk from v4 to v5