i have authenticated users using devise and omniauth facebook gem in my rails 3.2 app. How can i determine if two users are friends based on their uid only? Is it better to use Facebook query language or some other means? please provide an example
i have authenticated users using devise and omniauth facebook gem in my rails 3.2
Share
You can do this using the Graph API by checking
/me/friends/USER_ID_TO_TESTor FQL withSELECT uid1, uid2 FROM friend WHERE uid1 = me() and UID2 = USER_ID_TO_TESTOne of the two users has to be authenticated at the time or the query will fail.
The problem with this is that if the users are not friends, Facebook will return an empty data set. If you don’t like that, then you need to retrieve a user’s list of friends into your script and search the response for the friend to test.