【问题标题】:How can I get a facebook user first_name from app scoped user id如何从应用范围内的用户 ID 获取 facebook 用户 first_name
【发布时间】:2014-06-17 21:10:00
【问题描述】:

我不会将用户 app_scoped_user_id 转换为 user_id。

但是,我想要用户 first_name

如果我发送了http://graph.facebook.com/{user_id},那么我会得到正确的信息(例如:http://graph.facebook.com/100005247134894)但是

如果我发送了http://graph.facebook.com/{app_scoped_user_id},那么我会收到错误消息(例如:http://graph.facebook.com/265257860325783

如何使用 app_scoped_user_id 获取 first_name

【问题讨论】:

    标签: facebook-graph-api


    【解决方案1】:

    如果您使用用户访问令牌请求用户信息,则应始终使用/me。这样,您就可以避免使用不同的 user_ids 的麻烦。

    此外,如果您使用 app-scoped user_ids,您还需要使用您获取 app-scoped user_id 的同一 App 的 App Access Token 或使用相应的 User Access Token 发出请求。

    【讨论】:

    • 我有几个 app_scoped_user_id... 不只是我的。我想向这个用户显示 first_name
    • 正如我所写的,这仅适用于相应的应用程序。你需要明白/me总是相对于Access Token中编码的用户!
    【解决方案2】:

    假设您有一个具有访问令牌 ABCDE 的用户尝试访问另一个应用范围用户 ID 为 314159 的用户的名字:

    https://graph.facebook.com/?ids=314159&fields=first_name&access_token=ABCDE

    但如果您没有访问令牌,则获取名字是no longer possible

    In v1.0, there were API endpoints that didn't require an access token to call. In v2.0, all calls to endpoints now require an access token, except for calls to get an object's picture.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多