Facebook returning empty array from /me/friends - facebook

So I am use the 2.3 API Version trying to access the /me/friends list that returns all of my friends who are also using the app. Except, it always returns the following:
{
"data": [
],
"summary": {
"total_count": 889
}
}
I have tried using the Graph Explorer as well as the JS Sdk right within the browser with no luck.
I am requesting the user_friends permission and it is actually included by default. And yes, I have many friends who have been using our app. I debugged the token online via Facebook's debugger and concluded the token does indeed have that permission.
NOTE: Our app isn't listed in the Facebook app store. It is however Live and available to the public.
Can someone help?

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.
If user-a is friends with user-b in the above request, the response will contain the User object for user-b. If they are not friends, it will return an empty dataset.
Did you check this ?

Related

Getting list of friends using Facebook Graph API

I'm trying to get a list of friends using facebook explorer
https://developers.facebook.com/tools/explorer/{access-token}/?method=GET&path={fb-id}%2Ffriends&version=v14.0
access-token is auto generated (I'm using App Token) and {fb-id} is the Test User Accounts' id
This is what I got
{
"data": [
]
}
Just FYI: I'm using the test users as well as real accounts, and I've requested user_friends for my app (but currently rejected as I haven't been verified as individual and I haven't submitted my app for review)
On the app permission, it says that I've used user_friends API 25 times (for the past 30 days) -- but the number doesn't increase anymore
I could have sworn it works yesterday using my application, but now, it doesn't even works on the facebook explorer
This is the output that I see
fbFriend Connection[afterCursor=null beforeCursor=null data=[] nextPageUrl=null order= previousPageUrl=null totalCount=4 next=false previous=false]
Do I use the facebook explorer correctly?
Does anyone have the same problem?
thanks
Edited:
I've created test accounts with correct permission and invite/accept friend request from other test users
Per the User Friends documentation:
Only friends who have installed the app and who have granted the app the user_friends permission will be included.
Therefore, if no other user installed your application, you won't see them in the response. However, the total_count in summary object will reflect the actual number of user's friends.

Can I access facebook friendlist of a user using graph API, or I need to scrape?

I need to build a scraper that takes as input​ the Facebook credentials of a user and than scrapes all the friends of the user to do some statistical computations. How can I go with this? I get to know that graph API don't allow to access friend list of a user. So do I need to signin the user and then scrape the friendlist ?
I want to find the date/time they became friends, for each of the user's friend.
takes as input​ the Facebook credentials of a user
Never ever ask a user for his credentials. Always use Facebook Login to authorize users: https://developers.facebook.com/docs/facebook-login
scrapes all the friends of the user
Scraping is not allowed on Facebook: https://www.facebook.com/apps/site_scraping_tos_terms.php
The only way to get access to the friends of a user is to authorize the user with the user_friends permission and use the /me/friends endpoint. You can only get a list of friends who authorized your App with that permission too. The date/time you became friends is not available though.
More information: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app

Facebook user_friends permission

On my app, i have a feature that uses the user's facebook "user_friends" permission.
It used to work before they upgraded to API V.2.0, but now it does not:
When I created the app on FB and used test users (in development mode) my feature that includes this permission worked.
But, when i turned on the app (to be live) - it does not work.
So - it works on Test users but not on Live users.
How is that possible?
This is because /me/friends will only return those friends which also have used (via Facebook Login) the app making the request.
See
https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends/#readperms
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.

how to access user_friends list Facebook Graph Api v2.0 me/friends

list of my friends with access token without making any app in Facebook .
i used the new Facebook sdk but showing No node specified so how to access my friends list.
i already given permission request user_friends.
Check out the changelog: https://developers.facebook.com/docs/apps/changelog
Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.

Facebook Graph API location data missing, but visible on FB site search?

I'm noticing an inconsistency with the FB Graph API.
Suppose I'm logged in (and have access_token for) user Bob. Bob isn't friends with user Jim.
If I, as Bob, via the Graph API, ask for data about Jim:
https://graph.facebook.com/jim?access_token=blah&fields=location,hometown,name,id,address
I get a structure like this back:
{
"id": "1",
"name": "Jim"
}
Note that the fields that I've requested are conspicuously missing.
However, if I log in to the FB website as Bob, and then search for Jim, I can see his location and hometown on his "About" page, even if I'm not friends with him.
Why is this? Is there some additional token permission I have to specify or field I need to ask for in order to get this data (which is evidently rather public) from the API?
Got stuck on the same issue.
As I understand from end of this page access token has to include user_location and user_hometown permissions. Tried it in api explorer but had no success - still was not able to see location information through api for users that had this info visible on their profile page.
update: answers here and here suggest that data access through api / app is more restricted than through webpage to prevent web mining. I assume it is the case regardless you use user or app permissions.
If you are using a user access token then you might need to switch to using an app access token retrieved by a call like:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials