Get a list of friends of a friend on Facebook
I've recently started looking into the Facebook API and am trying to work out how to retrieve the list of friends of another user (in this case the user is someone I'm friends with).
So far I've only worked out how to find out the friends of a person who I am also friends with. However the Friends Wheel application can do it as you can generate a wheel base on one of your friends, so I'm guessing it is possible.
Anyone know how to do this?
You Can only access friends list of logged in user(i.e, your friend list) or the logged in user's friends that are users of your app. i.e, You can access friends friend list only if your friends are the users of your app.
You can check if two of your friends are friends using friends.are_friends
.
Once you've got a valid access token for a user, you can query the Graph API with said token and query the "friends" connection of the user object (/me/friends). So if your user ID is "123":
https://graph.facebook.com/123/friends?access_token=USERS_ACCESS_TOKEN
You can also use /me to reference the current user:
https://graph.facebook.com/me/friends?access_token=USERS_ACCESS_TOKEN
Without a valid access token, you cannot query information about users and access to friends of friends is determined by each user. For example, I cannot see some of my friend's friends:
Can't lookup all friends of (ID). Can only lookup for the logged in user (ID), or friends of the logged in user with the appropriate permission.
...but for some of my other friends, I can. There's probably a permission or flag you can check to see if they allow access, but I'm not currently seeing it.