I want to determine if two users (both using my app) have any mutual friends in common. The names/data of the users are irrelevant, the number of the mutual friends is irrelevant. I just need if two people have any friends on Facebook in common or not. The mutual friends may not be using the app, but the two ends ARE using my app. These were pretty easy in Graph API 1.0, but I'm wondering if what I'm trying to achieve is possible by any means in Graph API 2.0 or 2.1?
Asked
Active
Viewed 905 times
2 Answers
1
Use the mutual_friends API. How to use it is explained at https://developers.facebook.com/docs/graph-api/reference/v2.1/user.context/mutual_friends

WizKid
- 4,888
- 2
- 23
- 23
-
Totally missed it, docs are really messed these days. This works perfectly. Thanks. – Can Poyrazoğlu Oct 27 '14 at 20:01
-
@WizKid: That API works to find mutual friends between two users who are friends. "A valid user access token with user_friends permission is required to view the mutual friends of other friends using the app." What can one do to find mutual friends between User1 and User2 who are not friends? – Manas Paldhe Feb 27 '15 at 07:08
-
The users don't need to be friend. They both need to grant the app user_friends permission but they don't need to be friends – WizKid Feb 27 '15 at 07:10
-
"Additionally, the response will only include any mutual friends who have granted user_friends to the app." That seems to indicate that only users who use the app will be returned, so if the two users use the app, but their common friend do no, nothing will be returned. Can anyone confirm? – Guillaume Boudreau Sep 10 '15 at 19:54
1
Sorry to say, user A & B have to be friends if you want to use
/v.2.2/{user-id}?fields=context.fields(mutual_friends)
to check their mutual friends (e.g. C,D,E,F...)
I had double checked as @WizKid said, with the following sample:
1. A & B are friends, run the mutual_friends Graph API call ===> Found
2. unfriend A & B, run the same mutual_friends Graph API call ===> No data
3. Be-friended A & B again, run same Graph API call ===> Found

cck
- 23
- 5
-
"If you want to call this endpoint on behalf two app-users who are not friends, then you must provide the appsecret_proof parameter along with the user access token when making the request. This means you must call this endpoint from your server." Ref: https://developers.facebook.com/docs/graph-api/reference/v2.4/user.context/mutual_friends – Guillaume Boudreau Sep 10 '15 at 19:53