问题
Facebook API 1.0-2.0 has FQL, so I can get ID by FQL. But FQL will be removed in version 2.1.
$result = self::getAPI()->api("fql", "GET", array('q' => 'select uid from user where third_party_id="'.$thirdPartyId.'"', 'access_token' => Const::APPACCESS_TOKEN));
so question is how to get user id by third_party_id in API 2.1?
回答1:
You could still get facebook uid by facebook third party id by sending GET request to this Graph API endpoint:
https://graph.facebook.com/[THIRD_PARTY_ID]?access_token=[APP_ACCESS_TOKEN]
The response will have two fields: name
and id
, and the id
is what you want.
回答2:
Short answer: This is no longer possible with Graph API v2.1. There's no endpoint in the Graph API where you can pass the third_party_Id
. You should think about using the app-scoped user_id.
来源:https://stackoverflow.com/questions/26115668/how-to-get-user-id-uid-by-third-party-id-in-facebook-api-2-1