开发者

Get Facebook User ID By Email Address

开发者 https://www.devze.com 2023-01-07 00:07 出处:网络
We have over 10,000 registered users on our site and want to associate each user with a Facebook account with their facebook ID. Our site uses th开发者_运维百科e WWW::Facebook::API CPAN module for all

We have over 10,000 registered users on our site and want to associate each user with a Facebook account with their facebook ID. Our site uses th开发者_运维百科e WWW::Facebook::API CPAN module for all our other Facebook related actions on our site. My question is, is there a method where we can provide a specific user's email address (which they have provided to us during registration) and have the Facebook API return the matching user's Facebook user_id? To be clear we don't want the get the user's email through the Facebook API, but instead want to look them up using their email address. If there is it would be really helpful to see a code snippet of how this would work. Bonus points if this can done through the CPAN module we are already using. Thanks in advance for your help!


Yes, you can. In a way.

The new Search API allows you to search publicly available information about users.

https://graph.facebook.com/search?q=mailbox@example.com&type=user

As long as the email address you are searching for is public on Facebook (i.e., the user has it set that way in their preferences), it will return the user's name and Facebook ID.

The JSON

{
   "data": [
      {
         "name": "John Doe",
         "id": "123456789"
      }
   ]
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号