0
votes

My goal is to get a list of user facebook friends using Facebook Graph API. At least those, who have used social authentication on my website

I have read, that after v2.0 I can get only a list of friends, if the following conditions are met:

A user access token with user_friends permission is required to view the current person's friends. This will only return any friends who have used (via Facebook Login) the app making the request. If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person.

When I get a token and check

/v2.5/me/permissions

Result:

{
  "data": [
    {
      "permission": "user_friends",
      "status": "granted"
    },
    {
      "permission": "public_profile",
      "status": "granted"
    }
  ]
}

I am testing 2 user accounts, who are friends. I have used both for login in my web application using Facebook Login. But when I do

v2.5/me/friends

Result:

{
  "data": [
  ],
  "summary": {
    "total_count": 1
  }
}

What is the reason of empty friends set?

1

1 Answers

0
votes

Make sure all those friends authorized your App with user_friends too. If they only authorized without user_friends, they will not show up. The response looks like it worked correctly.

Sidenote: It is not allowed to have 2 user accounts on Facebook, you can only have one account - with your real name.