What's wrong with this?
public function hasAppPermission($permission)
{
return $this->api(array('method' => 'users.hasAppPermission', 'access_token' => $this->getAccessToken(), 'ext_perm' => $per开发者_运维百科mission));
}
Output:
array(
['method'] => 'users.hasAppPermission'
...
['access_token'] => '290034239987|2.SvGXXig_x3yjCkz7QDz4Wg__.3600.2293826300-130050996538485|UcFS331a75AR389Vtjz9rgDmpUg'
...
['ext_perm'] => 'user_birthday'
...
)
Are you testing this in a home server like xampp or similar? If it´s, there is the problem with authorization token. Because there are any valid certificate in localhost.
Maybe this is not an infinite access_token
?
Anyway, I don't think this is how it should be done, refer to this tutorial for more information:
$isGranted = $facebook->api(array(
"method" => "users.hasAppPermission",
"ext_perm" => "publish_stream",
"uid" => 579187142
));
if($isGranted === "1")
echo "Permission granted!";
精彩评论