如何通过调用Graph API获取Facebook用户元数据?

问题描述 投票:0回答:1

我在应用程序仪表板上注册了我的应用程序。我在应用程序仪表板上获得了应用程序 ID 和应用程序密码。

然后我就能够生成一个不记名访问令牌:

curl -X GET "https://graph.facebook.com/oauth/access_token?client_id={MY_APP_ID}&client_secret={MY_APP_CLIENT_SECRET}&grant_type=client_credentials"

然后我尝试通过调用获取元数据:

curl -i -X GET "https://graph.facebook.com/{AN_ID_OF_A_USER}?metadata=1&access_token={ACCESS_TOKEN_GENERATED}"

不幸的是,后面的调用仅适用于我自己的用户 ID,不适用于任何其他用户 ID。我收到其他用户 ID 的错误消息:

{"error":{"message":"Unsupported get request. Object with ID '12345678910' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100,"error_subcode":33,"fbtrace_id":"xXxXxXxXxXxXxXxXxXxX"}}

我应该做什么或设置什么,以及在哪里能够获取其他用户的元数据?我想对特定用户的关系状态感兴趣,以编程方式获取此元数据字段。

facebook curl facebook-graph-api
1个回答
3
投票

无法获取未授权您的App的用户ID,也无法获取未经授权的用户的任何其他数据。因此,如果相关用户没有授权您的应用程序,他将完全无法使用。

© www.soinside.com 2019 - 2024. All rights reserved.