登录后,facebook访问令牌无效

时间:2013-12-09 22:24:48

标签: php facebook yii

我试图登录我的应用程序vi facebook。 我在facebook中定义了我的应用程序。 我声明了loginurl

$url =   "https://graph.facebook.com/oauth/authorize?"
    ."client_id=579434135462930&"
             ."redirect_uri=http://localhost/final/index.php/user/login/&"
            ."scope=publish_stream,email";

当我连接时,我得到了oautj窗口并确认了许可。 当我回到

http://localhost/final/index.php/user/login/ 

我收到了这个错误。

OAuthException:必须使用活动访问令牌来查询有关当前用户的信息。

我试图通过

获取用户的电子邮件
if ($this->facebook->getUser())
         {
                     try {
           $this->facebook->setAccessToken($this->facebook->getAccessToken());
           $this->user_profile =$this->facebook->api('/me');

             } catch(FacebookApiException $e) {

            throw new Exception($e);
                error_log($e);

             }
                   return    $this->user_profile['email'];
       }
         return null;

我已经尝试过没有这一行了

$this->facebook->setAccessToken($this->facebook->getAccessToken());

同样的错误。

我已经尝试连接令牌

$this->user_profile =$this->facebook->api('/me&access_token='.$this->facebook->getAccessToken());

它不起作用! 请帮忙

0 个答案:

没有答案