Getting friends of friends in FB graph API

Abhishek picture Abhishek · Sep 29, 2010 · Viewed 12.5k times · Source

I would like to get friends of friends via an API call and when I try to do it, I get the following exception,

    {
   "error": {
      "type": "OAuthException",
      "message": "(#604) Can't lookup all friends of .... Can only lookup for the logged in user (...), or friends of the logged in user with the appropriate permission"
   }
}

The URL I am trying to access is,

https://graph.facebook.com/friend_id/friends?access_token=access_token

I am getting extended permissions which is as follows,

<fb:login-button perms="user_likes,friends_likes"></fb:login-button>

Could any one please let me know what's going wrong here? Or does it mean I can never get access to friends of friends?

Answer

Raphomet picture Raphomet · Sep 29, 2010

Currently, there is no extended permission that allows you to view a user's friends of friends. The "*_likes" permissions just show you the Facebook pages that the users have Liked.

It might be possible for you to iteratively fetch and cache the friends of each of the user's friends, one by one, but without access tokens for each friend, you'll only be able to fetch public data.