简体   繁体   中英

Omniauth + Facebook Mutual Friends Count

Is there a better/easier way to find mutual friends between users than creating a Friends table and logging the UIDs of each new user's friends? (Using Devise + Omniauth on Rails 3)

You dont need to log all UIDs. Are you using facebook provider ? If so, you can use Koala or FBGraph gems to form an FQL to find of there are any common friends.

If you already have the oauth_access_token available, you can use the koala gem.

@graph = Koala::Facebook::API.new(oauth_access_token)
friends = @graph.get_connections("me", "friends")

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