Reputation: 5746
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.
Upvotes: 3
Views: 548
Reputation: 22903
Are you sure you didn't forget the parameters as for the Facebook()
constructor?
$config = array();
$config[‘appId’] = 'YOUR_APP_ID';
$config[‘secret’] = 'YOUR_APP_SECRET';
$config[‘fileUpload’] = false; // optional
$facebook = new Facebook($config);
https://developers.facebook.com/docs/reference/php/
Or perhaps did you initialize your $facebook
object somewhere else in the code? In that case, you should:
$facebook
to your isPhotoPermission()
function in order to get it back,$facebook
as global
whether it is initialized in another function,$facebook = new Facebook();
line if $facebook
has been defined outside a function (would mean it is already global
).Upvotes: 1