Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Facebook User ID By Email Address

Tags:

facebook

perl

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 the 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!

like image 415
Russell C. Avatar asked Jul 14 '10 20:07

Russell C.


1 Answers

Yes, you can. In a way.

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

https://graph.facebook.com/[email protected]&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"
      }
   ]
}
like image 135
Peter Bailey Avatar answered Oct 04 '22 16:10

Peter Bailey