错误:FacebookApiException [190]:无效的OAuth 2.0访问令牌

时间:2011-02-27 17:39:14

标签: php facebook

这有什么问题?

    public function hasAppPermission($permission) 
{
    return $this->api(array('method' => 'users.hasAppPermission', 'access_token' => $this->getAccessToken(), 'ext_perm' => $permission));
}

输出:

array(
['method'] => 'users.hasAppPermission'
...
['access_token'] => '290034239987|2.SvGXXig_x3yjCkz7QDz4Wg__.3600.2293826300-130050996538485|UcFS331a75AR389Vtjz9rgDmpUg'
...
['ext_perm'] => 'user_birthday'
...
)

2 个答案:

答案 0 :(得分:1)

您是在xampp等家用服务器上进行测试吗? 如果是这样,授权令牌就存在问题。因为localhost中有任何有效的证书。

答案 1 :(得分:0)

也许这不是无限的access_token? 无论如何,我不认为这是应该如何完成的,请参阅此tutorial以获取更多信息:

$isGranted = $facebook->api(array(
    "method"    => "users.hasAppPermission",
    "ext_perm"   => "publish_stream",
    "uid"       => 579187142
));
if($isGranted === "1")
    echo "Permission granted!";