nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

Email's of users it's always nil!? #229

Closed javiersuazo closed 12 years ago

javiersuazo commented 12 years ago

I want to get the email of an user! But it's always nil!?!? I use fetch but nothing!!!

nov commented 12 years ago

you need "email" permission. https://developers.facebook.com/docs/authentication/permissions/

javiersuazo commented 12 years ago

I have that permission! This is my problem:

a = access_token user = FbGraph::User.me(a).fetch friend= FbGraph::User.fetch(user.friends.first.identifier, :access_token => user.access_token)

So, when I write something like this: friend.email it's always nil!! I get the access_token like this:

provider :facebook, "188819327887378", "92754ae5b56142b6ba35ac695ade4f32", {:scope => "user_about_me,friends_about_me,user_activities,friends_activities,user_birthday,friends_birthday,user_checkins,friends_checkins,user_education_history,friends_education_history,user_events,friends_events,user_groups,friends_groups,user_hometown,friends_hometown,user_interests,friends_interests,user_likes,friends_likes,user_location,friends_location,user_notes,friends_notes,user_online_presence,friends_online_presence,user_photo_video_tags,friends_photo_video_tags,user_photos,friends_photos,user_questions,friends_questions,user_relationships,friends_relationships,user_relationship_details,friends_relationship_details,user_religion_politics,friends_religion_politics,user_status,friends_status,user_videos,friends_videos,user_website,friends_website,user_work_history,friends_work_history,email,read_friendlists,read_insights,read_mailbox,read_requests,read_stream,xmpp_login,ads_management,create_event,manage_friendlists,manage_notifications,offline_access,publish_checkins,publish_stream,rsvp_event,publish_actions,manage_pages,user_subscriptions"}

And I have the email permission in the Auth Dialog in the app.

nov commented 12 years ago

email is for the token owner's email, not his/her friends. You can't get friends's email via Graph API. (See N/A next to email in the permissions document)

If you want to send email to the user's friends, send it to code>FRIENDS-FB-USERNAME@facebook.com</code.

javiersuazo commented 12 years ago

Thanks! :D I was thinking that yesterday! But now you confirm it!