以下是我的权限
$config['facebook']['permissions'] = array(
'email',
'user_location',
'user_birthday',
'publish_actions',
'manage_pages',
'public_profile',
);
我不能在facebook页面上发布管理员。它给了我这个错误
Exception occured, code: 200 with message: (#200) The user hasn't authorized the application to perform this action
如果我删除'access_token' => $pageList['access_token'],
,那么我可以在页面上发布但不能作为管理员发布。但是当我添加此行时它会给我上面的错误,任何人都可以告诉我为什么
这是我的功能pagePost,我用它在页面上发布
public function pagePost() {
if ( $this->session ) {
try {
$pageAccessToken;
$request_page = new FacebookRequest($this->session, 'GET', '/1420447421611683?fields=access_token,name,can_post');
$pageList = $request_page->execute()
->getGraphObject()
->asArray();
$request = ( new FacebookRequest( $this->session, 'POST', '/1420447421611683/feed',array(
'access_token' => $pageList['access_token'],
'link' => 'www.example.com',
'message' => 'Hello Up',
) ) )->execute();
echo "Posted with id: " . $request->getProperty('id');
$page = $request->getGraphObject()->asArray();
return $page;
} catch(FacebookRequestException $e) {
echo "Exception occured, code: " . $e->getCode();
echo " with message: " . $e->getMessage();
}
}
return false;
}
谁能告诉我有什么问题。 我将非常感谢。
答案 0 :(得分:1)
要将网页发布为“作为网页”,您需要使用“publish_pages
”授权用户,并且您需要使用网页令牌。尝试将publish_pages
添加到您的权限列表中:
$config['facebook']['permissions'] = array(
'email',
'user_location',
'user_birthday',
'publish_actions',
'publish_pages',
'manage_pages',
'public_profile',
);