简体   繁体   中英

Ruby using FbGraph gem :: get friends' email address

i'm trying to get friends' email address using FbGraph gem. i found somewhere that it said i can get them by 'email' object, so i tried but nothing happened. here is my code and..

me= FbGraph::User.me( @access_token )
@friends= me.friends

@friends.each do |f|
  puts f.email
end

is anybody know how i can get friends' email address from facebook by using Ruby FbGraph gem? thanks.

looks like you are missing the fetch for the user

@friends.each do |f|
  friend = FbGraph::User.fetch(f, :access_token => @access_token)
  puts friend.email
end

There should also be a way to fetch a list of users rather than doing a call per user

Unfortunately, Facebook docs now say this:
"Note: There is no way for apps to obtain email addresses for a user's friends."

source: https://developers.facebook.com/docs/reference/login/email-permissions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM