开发者

manage_pages granted, but can't get accounts info

Yesterday I developed a little script (app), where I was able to upload photos to a specific album of a fanpage while visiting this fanpage (with installed app) as a fan.

Yesterday it worked - today it still works. But then I just copied the files and created a new app. The only difference is, that all files lay on another server. I granted following permissions with my fanpage admin account to the app: manage_pages, publish_stream and offline_access.

Now I just want run following code:

<?php $userAccounts = $facebook->api('/' . _ADMIN_ID . '/accounts');?>

But I get all time the error msg, that a user access token is needed. When I remove /account like:

<?php $userAccounts = $facebook->api('/' . _ADMIN_ID);?>

then it works without a problem and I get the admin informations. When I check my privacy settings, it says that I've granted the permissions that I mentioned above.

Here is the code I run until开发者_JAVA百科 the error appears:

<?php
include_once('config.php');
include_once('facebook/facebook.class.php');

$facebook = new Facebook(array(
  'appId' => _APP_ID,
  'secret' => _APP_SECRET,
  'cookie' => true,
  'fileUpload' => true
));
$userAccounts = $facebook->api('/' . _ADMIN_ID . '/accounts'); 
?>

Again: This app has the manage_pages, publish_stream and offline_access permission and without '/accounts' I get all information bout my admin-account.

Any help would be very nice.

Thanks in advance, Jurik


Obviously when you are calling: $facebook->api('/' . _ADMIN_ID); you are getting the public info about that user just like calling:

https://graph.facebook.com/_ADMIN_ID

You said that you granted the offline_access? so use the stored access token with your calls:

$userAccounts = $facebook->api('/' . _ADMIN_ID . '/accounts?access_token=' . $stored_access_token);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜