views:

109

answers:

1

It is straightforward to retrieve a list of friends from Facebook using their api.

But how would a site figure out which of its members corresponds to the Facebook friend it has imported?

Is there a unique id that could be used? For example, does Facebook give the email address of the friend, so that could be compared to see if a person with the same email address is a member of the social network?

If not, how would you address this problem?

+1  A: 

Facebook doesn't expose the email address directly, since it needs to be sure that you can no longer contact a user after they remove your application. However, they use a hash of the email address to identify which of your existing members correspond to Facebook users.

First you need to tell Facebook about your members using Connect.registerUsers, then you can retrieve the email hashes of user's friends with a bit of FQL...

SELECT uid, email_hashes, has_added_app
FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = XXX )
stevemegson