【问题标题】:get the facebook reviews return error获取 facebook 评论返回错误
【发布时间】: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


【解决方案1】:

确保您确实在使用页面令牌。将 Token 放入 Debugger 中,查看是否为 Page Token:https://developers.facebook.com/tools/debug/

更多关于代币的信息:

【讨论】:

  • App ID 817943358271981 : dog 用户 ID 1404081353236344 发布未知过期 1424948400(15 小时前) 有效 假 来源 未知 范围 public_profile, basic_info, read_stream, read_mailbox, read_page_mailboxes, rsvp_ights, email, read_friendlist manage_pages、publish_actions、user_birthday、user_religion_politics、user_relationships、user_relationship_details、user_hometown、user_location、user_likes、user_activities、user_interests、user_education_history ......它显示这个它不显示令牌类型
  • 不像我怀疑的那样是页面标记。页面标记包括页面的 id。
  • 你真的应该减少你的权限。很多。
  • 如果您使用的是页面令牌但收到此响应?
  • 那么您很可能没有真正使用页面令牌...调试器说什么?
【解决方案2】:

当您请求多个权限时,其中一些可能适用于您正在调用的端点,而另一些可能不适用,从而导致此 210 错误。

就我而言,将profile_pic 权限添加到/me?fields=id,first_name,last_name,email 会导致此错误。

【讨论】:

    猜你喜欢
    • 2012-07-29
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    • 2014-01-23
    • 1970-01-01
    • 2022-12-09
    • 2016-07-25
    • 2019-08-11
    相关资源
    最近更新 更多