Facebook mutual_friend_count wrong?

6.7k Views Asked by At

I would like to know if anyone else has experienced this problem...

Facebook's count of mutual friends is off by 1. One too much. But not for all friends. I've tested this through my app where the fetched mutual_friend_count does not correspond to the number of mutual friends in the fetched array.

Further I have been checking this manually. By going to a FB-profile and literally counted our mutual friends. This also shows that we have one less mutual friend than the number Facebook is displaying in the "Mutual Friends" section on a friend's profile.

This does not apply for all my contacts on Facebook. Some profiles are displaying the number of mutual friends corresponding to the actual number of mutual friends.

But this do posses a problem if you are building an application/wesite/facebook app etc. that somewhat relies on the mutual_friend_count.

Can anyone confirm this? Is this a bug? Or is it some kind of setting that some users can avoid being shown in the mutual friend section, but is still counted...?

2

There are 2 best solutions below

0
Caveman42 On

I can confirm that the mutual friend count is reduced by 1 sometimes. I counted a few, and some are right, and others are 1 less then it should be. It could be a setting in the privacy tab, I'm sorry I'm not much help.

0
Unome On

I've been doing some work with mutual_friendsand I figured I'd give my 2-cents on what I've learned on this issue, which may or may not correspond to whats not working on yours.

Documentation for mutual_friends via Facebook Graph API is here

From the docs:

The user in the request and the session user must both have granted user_friends permission to the app.

This is a common mistake I was making. Even if you have mutual friends between users, if the friend has not given permission to the app, then you can't get their picture/name or any info on them, they simply appear in the total_count parameter.

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.

This is also very important. If the two users aren't friends, then this endpoint will silently fail you providing NOTHING even though they have mutual friends. In order to actually get the data for this scenario, you need to be calling the endpoint from your server, not your client. That means not your javascript webapp, not your android app and not your iOS app.

There are some additional edge cases, such as users not providing the mutual_friends permission to your app, among other issues but at least for me these were the main issues I ran into. I never had any off-by-one errors, so I can't confirm your bug.