0

I'm trying to test the Facebook user friend list with 3 test users from facebook, i've already set them as friends and the permission user_friends, the problem is that i'm always getting an empty array from the facebook graph api.

A example of the requisition i'm using: https://graph.facebook.com/v12.0/{user_id}/friends?access_token={token}¹ i replace the user_id with this test user id, and same for the token

I know i'm requesting the right user_id and token because if i just do https://graph.facebook.com/v12.0/{user_id}² i'll be able to get this user information.

I have logged this users onto my website with facebook and accepted the request for acess the friendlist, but still cannot get their friends with the request 1.

I've tried to set my facebook app on development and production, and nothing changed.

I've tried with both users logged at the platform, with no success too.

When i'm logged at the facebook with any of this test users, i can see the others on their friendlist, and when i get into settings > Apps and Websites i can see my app registered in both accounts, but still getting an empty list

The return i recive with the 1 request is this:

{
    "data": []
}

What have i forgotten on to my tests?

3 Answers 3

1

I found what was the error, my app was with type "Consumer", when i removed the type i could make the request and receive the correct return from the Graph API.

But why it wasn't working with type "Consumer" i don't know, on the documentation it says this type has the permission ¹ but is really not working.

1
  • Sadly, I removed our type from our app and it still fails. Oct 17, 2022 at 22:37
0

I was stuck two weeks on the same issue while trying to make my app approved by Meta Developper for 'user_friends' permission. I created several test users within my facebook app and while using the Graph API Explorer tool, even if all of these users were friends / my app installed / 'user_friends' granted, the returned json response contained an empty test user friend list. Only the total size was returned correctly.

I found a workaround : clone my facebook app as a TEST app and then created TEST users from this new TEST app. Then, when testing the tool Graph API Explorer with these new tests users token, the returned response was containing a not empty test user friend list.

Also, I did not change my app type (Consumer)

0

I finally managed to get it to work. No need to change the type.

go to the test user account section in your app. for each user you have an option btn (3 dots).

  1. go to Change the permission -> add user_friends permission
  2. go to manage friends -> add other friends

then I had to log in a test user to fb and sign in in to my app from the test user account. I did this to 2 test users. after that I tried the graph API explorer and it worked.

https://i.stack.imgur.com/oLBYN.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.