簡體   English   中英

如何通過調用 Graph API 獲取 facebook 用戶元數據?

[英]How can I get a facebook user metadata by calling the Graph API?

我在 App Dashboard 注冊了我的應用程序。 我在應用儀表板上獲得了一個應用 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"}}

我應該做什么或設置什么,以及在哪里可以獲得其他用戶的元數據? 我想對特定用戶的關系狀態感興趣,以編程方式獲取此元數據字段。

沒有辦法獲取到沒有給你App授權的用戶ID,也沒有辦法獲取到其他未經授權的用戶數據。 因此,如果有問題的用戶沒有授權您的應用程序,他將完全不可用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM