Ralph
Ralph

Reputation: 430

Get facebook emails using django

I'm using django-socialregistration and facebook python sdk.

This is the code to get friends:

friends = request.facebook.graph.get_connections('me', 'friends')

I can get their name and id but I can't get their email address (not their @facebook.com email).

This is another attempt which also can't get their email.

for friend in friends['data']:

    request.facebook.graph.get_object(friend['id'])

How can I get the facebook friends email?

Upvotes: 2

Views: 1617

Answers (2)

Jordan Reiter
Jordan Reiter

Reputation: 21002

It is possible to get the email of a user connected to your app using Graph. However, when connecting or signing in using Facebook users must explicitly give you permission to use their email address. Since none of the friends gave you permission, their e-mail addresses are off limits. What this means is you can encourage the user to have their friends join as well, and make sure that when they sign up you include a request for their e-mail address.

Upvotes: 2

Arthur Neves
Arthur Neves

Reputation: 12128

I think you are not getting the email from friends because this is not even possible to get from Facebook`s Graph API.

Check this out: Facebook Graph API, how to get users email?

Upvotes: 0

Related Questions