I got following error
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /home/.../third_party/base_facebook.php on line 1106
my function is,
public function isPhotoPermission()
{
$facebook = new Facebook();
$access_token = $facebook->getAccessToken();
$permissions = $facebook->api("/me/permissions","GET",array('access_token' => $access_token));
if( array_key_exists('user_photos', $permissions['data'][0]) )
{
return 1;
}
else
{
return 0;
}
}
that 1106 line is,
1105: protected function throwAPIException($result) {
1106: $e = new FacebookApiException($result);
1107: switch ($e->getType()) { ....
error occurring by following code:
$permissions = $facebook->api("/me/permissions","GET",array('access_token' => $access_token));
Where is the Problem? Thanks for advance.
Are you sure you didn’t forget the parameters as for the
Facebook()constructor?https://developers.facebook.com/docs/reference/php/
Or perhaps did you initialize your
$facebookobject somewhere else in the code? In that case, you should:$facebookto yourisPhotoPermission()function in order to get it back,$facebookasglobalwhether it is initialized in another function,$facebook = new Facebook();line if$facebookhas been defined outside a function (would mean it is alreadyglobal).