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?
2
Answers
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.
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)