2011-12-08 92 views
3

我需要帮助才能获取Facebook用户的电子邮件。这是我所做的。如何使用graph api查询Facebook用户的电子邮件?

https://graph.facebook.com/me?scope=email&access_token=xxxxxxxxxxxxxxxx

结果我回到中没有任何邮件。

  { 
       "id": "7027110", 
       "name": "John Mike", 
       "first_name": "John", 
       "last_name": "Mike", 
       "link": "http://www.facebook.com/john.mike", 
       "username": "john.mike", 
       "location": { 
        "id": "11241875545", 
        "name": "Oakland, New Jersey" 
       }, 
       "gender": "male", 
       "timezone": -5, 
       "locale": "en_US", 
       "verified": true, 
       "updated_time": "2011-12-07T16:53:47+0000" 
      } 

也试图将scope = email更改为fields = email,仍然无效。缺少什么,请帮助我

+0

我不认为你的意思是能够获得这些信息。它对普通用户不可用。它也会导致严重的垃圾邮件问题。 – Polynomial

+0

这可能是因为他们没有公开电子邮件:(这里试试这个: 'https://graph.facebook.com/me/fql?access_token=<你的访问令牌>&q =选择%20name,email %20from%20user%20where%20uid = me()' 或 'https://graph.facebook.com/me/fql?access_token=<您的访问令牌>&q =选择%20name,电子邮件%20from%20user% 20 where%20uid%20in%20(select%20uid2%20from%20friend%20where%20uid1%20 = me())' –

+0

无论我做了什么都是正确的,但是,我没有权限查询用户的电子邮件。第一次用户登录时,我需要询问他是否允许我进入。 – qinking126

回答

1

您是否从用户那里获得email扩展许可?您可以通过致电/me/permissions

1

查看授予您访问令牌的权限。用户必须先授权您获取此信息。如果可能的话,我们会收到比我们已经收到的垃圾邮件多100倍的垃圾邮件。

Facebook tool可以帮助你。

5

你可以得到用户的电子邮件这样的: https://graph.facebook.com/v2.5/me?fields=id,name,email 更详细的去here

相关问题