steve
steve

Reputation: 11

Unable to get Facebook friends list

I'm using facebook sdk for c# and I have tried the code here :- you can see code in zip file

download code zip file

but problem in code is it is not retrieving friends list like i am using this line of code to get friends

dynamic me = fb.Get("me?fields=friends,name,email,favorite_athletes");

but it is not retrieving friends

Upvotes: 1

Views: 759

Answers (1)

Bhumit Mehta
Bhumit Mehta

Reputation: 16318

There have been few changes in Graph API version 2.0 which might be reason behind this.

1.Facebook only returns friends who are using your app since Graph API 2.0 for apps which are created after 30 April 2014.

Check Facebook docs

/me/friends returns the user's friends who are also using your app

In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.

So it means unlike 1.0 version you will not get list of all the friends that are on friendlist of user, instead you will get list of only those friends who have also authorized your app.

  1. You also need to ask for permission user_friends in Graph API V2.0 which was default in version 1.0

In v1.0 and earlier, the list of friends was available as part of the default permission set. To give people more control about the info they share with apps, we've separated the list of friends from the default. We have added a new permission so that you can ask for the list of friends. That permission is called user_friends. In order to use user_friends, you will need to add it to the list of scopes in your app when requesting permissions.

Most probably you are not receiving friends list because of one of the two reasons. Hope this helps

Upvotes: 2

Related Questions