在Javascript中从uid获取Facebook third_party_id

时间:2011-09-09 17:10:38

标签: facebook

有没有人如何在Javascript中从'uid'获取third_party_id?

我正在努力寻找它,但没有成功。

问候。

1 个答案:

答案 0 :(得分:8)

third_party_idUser object in the Graph API上的字段,但它不是默认字段 - 只有在您明确请求时才会返回,例如

GET https://graph.facebook.com/me?fields=third_party_id&access_token=[YOUR ACCESS TOKEN]

将返回:

{
  "third_party_id": "[THIRD PARTY ID]", 
  "id": "[USER ID]", 
  "type": "user"
}

在javascript中,您最有可能想要致电

FB.api("/me?fields=third_party_id", function (userData) { 
    alert("Your Facebook ThirdPartyId is: " + userData["third_party_id"]);
});