Get facebook friends with Graph API v.2.0

Giacomo Cerquone picture Giacomo Cerquone · May 1, 2014 · Viewed 75.7k times · Source

A while ago, I used to take the friends of mine using Graph API in this way (using Graph API Explorer):

/me/friends

Everything was perfect but now, with 2.0 version, I saw that this way does not function for friends who didn't use (via Facebook Login) the app making the request and, if I switch Graph API Explorer to 1.0 version, it functions.

So, how can I do the same thing with the 2.0 version?

Answer

Simon Cross picture Simon Cross · May 1, 2014

In v2.0 of the API, /me/friends returns friends who also have logged into the app.

Apps created on or after April 30th 2014 must use Graph API v2.0; they're not able to call Graph API v1.0.

For apps which were active before April 30th, these apps can call either Graph API v2.0 or Graph API v1.0, but Graph API v1.0 will be deprecated on April 30th 2015.

Note that if a user logs into an app via v2.0, and you call /v1.0/me/friends, this will still only return app-using friends.

If you want to access non-app-using friends in the case where you want to let your users tag people in stories you publish to Facebook, you can use the /me/taggable_friends API.

In the case where you want to invite people to use your app, Games can use the /me/invitable_friends endpoint in order to render a custom invite selector. The tokens returned by this API can then be used in the Requests Dialog. See https://developers.facebook.com/docs/games/invitable-friends/v2.0 and https://developers.facebook.com/docs/games/requests/v2.0

For non-games wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the Message Dialog on iOS and Android