skozlovf
skozlovf

Reputation: 241

Facebook Graph API and friend's email

There are some question on the StackOverflow about facebook & email, but after reading them I still have a problem with retrieving users emails.

Our app implemented on Flex and uses REST API. And previously it used notifications.sendEmail. App has publish_stream and email permissions (checked with users.hasAppPermission).

I tried users.getInfo for get proxied_email address. But this function does not return email address of the friend..

Then I performed the following test using Graph API and web browser:

  1. Opened the following link for authorization with extended permissions:

    https://graph.facebook.com/oauth/authorize?client_id=[app_id]&scope=publish_stream,offline_access,email&redirect_uri=http://www.facebook.com/connect/login_success.html

It returned code for retrieving access_token

  1. Oppened the following link for retrieving access_token

graph.facebook.com/oauth/access_token?client_id=[app_id]&client_secret=[secret]&code=[code]&redirect_uri=http://www.facebook.com/connect/login_success.html

It returned access_token. And now I can use GraphAPI.

  1. Tested with my account

graph.facebook.com/me?access_token=[token]

Ok. It returned my emal.

  1. Tested with my friend

    graph.facebook.com/[friend_id]?access_token=[token]

And here is no email field!

So my questions are

Where did I go wrong? Is it possible to get friend's email via Facebook API (GraphAPI or REST API)?

Thanks.

Upvotes: 11

Views: 23324

Answers (4)

Aks
Aks

Reputation: 101

I think that getting friends' email ids is not permitted by Facebook; at least, that's what my research tells me. @helloworld: Who told you that janrain gets users' friends' email ids?

Upvotes: 0

The Surrican
The Surrican

Reputation: 29874

Only with the extended permission you can specify via the scope attribute, when obtaining the access token

Example:

https://graph.facebook.com/oauth/authorize?
    client_id=...&
    redirect_uri=http://www.example.com/callback&
    scope=email

Upvotes: -1

helloworld
helloworld

Reputation: 2311

there ought to be some way else how does JanRain does it? http://www.janrain.com/products/engage/invite-friends

Upvotes: 0

serg
serg

Reputation: 111325

Email permission gives access to your email only.

If you look at the extended permissions page it says:

Likewise, to protect the privacy of users who have not explicitly authorized your application, your application will only be able to access the basic profile information about a user's friends, like their names and profile pictures. If your application needs to access other data about a user's friends to enable social functionality, you will need to request some of the special friends permissions listed below.

And if you look at the table below, it says "not available" for email permission for friends.

Upvotes: 28

Related Questions