question

brendan avatar image
brendan asked

Can't get Facebook friends to show up

Brendan Vanous
started a topic on Wed, 13 May 2015 at 11:55 PM

Question from a developer:

I've got multiple accounts set up in the PlayFab system, linked to their Facebook accounts. They're all friends, but they're not showing up in each other's friends lists when I call GetFriendsList. Why is that?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Wed, 13 May 2015 at 11:56 PM

The Facebook system can be a little hard to follow, since there are multiple steps:

First, be sure that you have an application set up in the Facebook Developer site (https://developers.facebook.com/), and that if you want to use Facebook for purchasing, you have the the App ID and App Secret set up in your Facebook configuration for the title (in your title's Add-ons Marketplace tab).

Next, when querying for a token, the easy way for initial testing is to just use the Graph Explorer (Tools->Graph API Explorer from the developer site). When using it, you do need to make sure to click "Get Token", select "Get Access Token", and then make sure user_friends is selected in the table of permissions. A good way to check that it's set right (and that the friends are all linked in FB) is to change the query from /me to /me/friends in the query box, and click submit. You should see all of your user's friends in the results.

Once the app is configured and you've got the right privileges set, you'll need to sign into the accounts one by one, and link their Facebook accounts using the token you get from the Explorer (use the Unlink API call, if you already have one set, to make sure). Once you have, you should be seeing everything in the GetFriendsList call.


2 Comments
Brendan Vanous said on Wed, 13 May 2015 at 11:56 PM

The Facebook system can be a little hard to follow, since there are multiple steps:

First, be sure that you have an application set up in the Facebook Developer site (https://developers.facebook.com/), and that if you want to use Facebook for purchasing, you have the the App ID and App Secret set up in your Facebook configuration for the title (in your title's Add-ons Marketplace tab).

Next, when querying for a token, the easy way for initial testing is to just use the Graph Explorer (Tools->Graph API Explorer from the developer site). When using it, you do need to make sure to click "Get Token", select "Get Access Token", and then make sure user_friends is selected in the table of permissions. A good way to check that it's set right (and that the friends are all linked in FB) is to change the query from /me to /me/friends in the query box, and click submit. You should see all of your user's friends in the results.

Once the app is configured and you've got the right privileges set, you'll need to sign into the accounts one by one, and link their Facebook accounts using the token you get from the Explorer (use the Unlink API call, if you already have one set, to make sure). Once you have, you should be seeing everything in the GetFriendsList call.


johntube said on Fri, 15 May 2015 at 7:59 AM

@Brendan :

Good to know ! I didn't know about this I thought I needed to manually query facebook friends using facebook SDK then call GetPlayFabIdsFromFacebookIds !

I'll add "IncludeGoogleFriends" as Optional argument in the Google features request. Please mark it as unimplemented !

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Daniel Kiefer avatar image
Daniel Kiefer answered

currently also not able to get the friends list.

Just to be clear Adding the App ID and the App Secret in Settings->Secret Key has now moved to Add-Ons?

when i am quering the list in the Graph API Explorer i am getting 2 friends back. But i am not getting any when i am making the GetFriendListRequest with IncludeFacebookFriends set to true.

 

 

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Daniel Kiefer avatar image
Daniel Kiefer answered

Guess i just found the error. They are only showing app if the friends are linked to a playful account, right?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Correct - the way that Facebook's policies work, you can only display friends in a title if those friends have also played the title. So your friends would also have to have played the game, either signing in with Facebook or linking the Facebook account, to appear in your friends list.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

cs54com avatar image
cs54com answered

This still does not appear to be working on my end. I'm using the obj-c sdk in a swift project, most things work great. Here's what I have so far:

- My app is fully setup in facebook

- I've tested via: facebook.com/tools/explorer/ and verified I'm seeing "friends"

- From your reply, what does "(in your title's Settings->Secret Keys tab)" point to, is this on facebook's side, or playfabs, do I need to add a secret key to facebook from playfab of vice versa?

- I see data in the leaderboards for each a "friend" coming through in my call for "GetFriendLeaderboard" - (friend ID) 4C40FC41F7462866

- With that "friend ID), calling GetAccountInfo or GetFriendsList returns empty results with result.Friends an array with nothing in it (not previous call of GetFriendLeaderboard had an item)

- Also from the reply, is there a need to "link their Facebook accounts using the token you get from the Explorer", I thought this was done automatically when making the calls since the auth happens when you login to facebook.

- Charlie

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

cs54com avatar image
cs54com answered

@Brendan Vanous Forgot to add this. :-D

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

cs54com avatar image
cs54com answered

Created a new account app, re-linked all accounts, and now some data is coming through. Still not 100% sure what step I might have missed that would have caused this.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Not sure, but I'm glad to hear you've got it working. The keys are:

1. Link the Facebook account to the PlayFab account (using the token and either LoginWithFacebook if that's your primary auth mechanism or LinkFacebookAccount if you have a pre-existing PlayFab account from a Device ID login, etc.).

2. Make sure you're getting a token with the Friends permission (user_friends) from Facebook when you log into PlayFab using the Facebook token.

3. Whenever you call GetFriends of get one of the friends leaderboards, make sure you set IncludeFacebookFriends to true.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dean Loades avatar image
Dean Loades answered

@Brendan I am also having this issue. The friends come through in the Graph Explorer, but GetFriendsList returns 0 results.

I have noticed that the playfab accounts where I have used LoginWithFacebook don't show any linked accounts when I look at the player overview in the dash. It says Origination: Facebook, but nothing linked and it doesnt display the facebook Id anywhere which seems a bit fishy to me.

My other accounts that have used a guest login and then LinkToFacebook DO show facebook in the linked accounts.

WRT the "Settings->Secret Keys tab", it does not appear to exist so I don't know where I am meant to enter the Facebook credentials.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

The place to put the setup info for Facebook has moved since this was originally posted - it's now in the Add-ons Marketplace for your title. I've updated the post to reflect this.

Can you confirm that a) the auth token you're getting from Facebook has the user_friends permission, b) that both friends have signed into the title with Facebook or linked their Facebook accounts, and c) that you're setting IncludeFacebookFriends to true in the call? Can you provide the Title ID you're testing and the PlayFab IDs of the users in question?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.