HELP! 400 Bad Request on me/invitable_friends

Hi all,

I’ve been searching around and tried many things for many days now, I haven’t been able to get through this problem.

I get “400 Bad Request” when I try to call “me/invitable_friends” like this:

FB.API(“me/invitable_friends”, Facebook.HttpMethod.GET, CallBackLoadInvitableFriends);
function void CallBackLoadInvitableFriends(FBResult result) {
Debug.Log(result.Text);
}

I’m on Unity 4.7.1, Facebook SDK for Unity 6.2.2. I’m using the access token to login, it logs in. This FB app is in the “Games” category and I believe this has the required “Canvas”, although I’d like to know how I can confirm that I have the “Canvas” requirement.

==

I tried to get “friends” instead and it gave me some results, but I don’t understand why the data is empty and the count is 12, if I have 12 in “total_count”, am I not suppose to have 12 records in the data?

FB.API(“me/friends”, Facebook.HttpMethod.GET, CallBackLoadInvitableFriends);
function void CallBackLoadInvitableFriends(FBResult result) {
Debug.Log(result.Text);
}

Result:
{“data”:,“summary”:{“total_count”:12}}

Mobile games, despite what you might think, aren’t supposed to use the invitable_friends graph calls unless you also have a canvas app.

A Canvas App is basically web version of your game running in the browser. If you have this, you can then use invitable_friends on the mobile platform as well as in the canvas app.

However, you can (or at least used to be able to - they may have changed it), trick Facebook into allowing mobile applications to use invitable_friends by providing a canvas app URL which could possibly just point to your website or an appropriate download location for your app. You set this in the Facebook App settings within the developer portal.

Newer versions of the Facebook SDK include additional App Links for inviting friends - it’s not a list of friends but it does allow you to invite friends (without the need to be logged into Facebook through your game too, which is an advantage). As you’re using Unity 4 still, these may not be available to you.

Remember that you also need to request the user_friends permission from facebook. This is a common request now so shouldn’t cause your users any concern.

As to why you’re getting no data in the me/friends data, I’m not sure. I’ve not seen this before but again, I’d check that you actually have the user_friends permission and that you are using an appropriate login account (you may need to setup your Test users in the facebook developer portal for this app).

Also, make sure your app is set as a ‘Game’ in the facebook developer portal.

“me/friends” only returns friends that have already authorized the game. It won’t do any good for sending invites.