Facebook API - uid 和电子邮件

问题描述:

我正在尝试开发一个应用程序,其中

I am trying to develop a application where

  1. 用户X"已登录 Facebook
  2. 应用有一组电子邮件地址(可能是用户X"的朋友)
  3. app 获取用户X"的好友列表(uid)
  4. 想通过使用电子邮件地址检查电子邮件地址为 some@some.com 的用户是否是有效的 Facebook 用户,并且是用户 X 的朋友(基本上是电子邮件映射的 uid)

是的,这是可能的.首先,获取用户所有朋友的 UID.然后,执行此 FQL 以获取每个朋友的 email_hashes:

Yes, this is possible. First, get the UIDs for all of a user's friends. Then, execute this FQL to get the email_hashes for each friend:

SELECT email_hashes FROM user WHERE uid IN (comma_delimted_set_of_uids)

由于您已经拥有电子邮件地址,您可以对其进行哈希处理并将其与 Facebook 的 email_hash 进行比较.如果你有一个匹配,你就知道它是有效的.根据 FB 文档,每个电子邮件哈希的格式是电子邮件地址的 crc32 和 md5 哈希加上下划线 (_).

Since you already have the email address, you can hash it and compare it to facebook's email_hash. If you have a match, you know it's valid. According to the FB documentation, the format of each email hash is the crc32 and md5 hashes of the email address combined with an underscore (_).