【发布时间】:2015-02-26 12:23:51
【问题描述】:
我首先使用 facebook api 获取页面令牌
function createSession($app_id,$app_secret){
FacebookSession::setDefaultApplication(
$app_id,$app_secret
);
$testUserPermissions = array('user_actions.books','user_actions.fitness','user_actions.music','user_actions.news','user_actions.video','user_birthday','user_games_activity','user_groups','user_hometown','user_interests','user_location','user_relationship_details','user_religion_politics','user_tagged_places','user_videos','user_work_history','read_friendlists','read_page_mailboxes','manage_notifications','read_mailbox','publish_actions','read_stream', 'user_photos','manage_pages','public_profile','user_friends','email','user_about_me','user_activities','user_education_history','user_events','user_likes','user_relationships','user_status','user_website','read_insights','rsvp_event');
$testUserPath = '/' . $app_id . '/accounts/test-users';
#$testUserPath = '/100008488695640/accounts/test-users';
$params = array(
'installed' => true,
'name' => 'User test',
'locale' => 'zh_TW',
'permissions' => implode(',', $testUserPermissions),
);
echo var_dump($params);
$request = new FacebookRequest(new FacebookSession($app_id . '|' .$app_secret), 'POST', $testUserPath, $params);
$response = $request->execute()->getGraphObject();
echo var_dump($response);
#$testUserId = $response->getProperty('id');
$testUserAccessToken = $response->getProperty('access_token');
return new FacebookSession($testUserAccessToken);
}
这是我的获取令牌
然后我使用这个令牌来获取评论
https://graph.facebook.com/v2.2/185342243407/ratings?field=open_graph_story&access_token=$token_value
但它会返回
{ “错误”: { "message": "(#210) 此调用需要页面访问令牌。", “类型”:“OAuthException”, “代码”:210 } }
如何获取页面令牌?
令牌没有被使用?
【问题讨论】:
-
你找到解决方案了吗,请帮忙...
标签: facebook facebook-graph-api review