question

YangYi avatar image
YangYi asked

GetFriendLeaderboardAroundPlayer not returning Facebook friends.

We are trying to viewing all scores around a player to seeing their Facebook friend's score.When querying GetFriendLeaderboardAroundPlayer, we are only seeing the player's score even though IncludeFacebookFriends is set to true. Both of us have installed the game and logged in to PlayFab via our Facebook accounts and are definitely Facebook friends.How could i fix this?

Beblow is our code

			PlayerProfileViewConstraints pc = new PlayerProfileViewConstraints();
                pc.ShowAvatarUrl = true;
                pc.ShowDisplayName = true;
                var request = new GetFriendLeaderboardAroundPlayerRequest
                {
                    IncludeFacebookFriends = true,
                    IncludeSteamFriends = false,
                    MaxResultsCount = 10,
                    StatisticName = "Leaderboard",
                    ProfileConstraints = pc
                };
                PlayFabClientAPI.GetFriendLeaderboardAroundPlayer(request, result =>
                {
                    leaderboardItems = result.Leaderboard;
                    int count = 0;
                    print(" Leaderboard count " + leaderboardItems.Count);
			}

All the player's score are on the leaderboard

The two player's facebook privacy setting are

we provide our relevant informations to you for test

Title ID: 3D47

Statistic ID:Leaderboard

PlayfabID:C7FBD8286E8DA854

PlayfabID:EEF5E467FF4BA24C

Leaderboards and StatisticsFriends
2.png (24.3 KiB)
10 |1200

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

Seth Du avatar image
Seth Du answered

I have tried to reproduce your issue and I believe you didn’t completely understand what this API can do. Please check my testing process below to see if you missed anything.

1. I create few test users. Our test user is Emily and I add 3 friends for her, Jennifer, Sandra, Carol.

2. In the PlayFab Game Manager, I add Statistics (the key is named “0”) for them. there are 3 other test accounts that have the same statistics.

3.I login with Emily account, and call GetFriendLeaderboardAroundPlayer witha similar request as you provided. The result only shows Emily’s Facebook Friends’ statistics, which is expected.

Here is the conclusion:

  • This API will not return the full Facebook friend list.
  • The callback cannot provide those friends who do not have this statistic, which also means they must already be in the same PlayFab leaderboard.
  • Setting ProfileConstraints works like filtering the normal result.

3 comments
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

The callback result:

0 Likes 0 ·
YangYi avatar image YangYi commented ·

Thank you for your reply.

I checked Yang Yi and Star Rock are facebook friends, and they are all logged into playfab.

0 Likes 0 ·
YangYi avatar image YangYi YangYi commented ·

but Yang Yi and Star Rock aren't automatically add playfab friends

0 Likes 0 ·
YangYi avatar image
YangYi answered

@SethDu Thank you for your reply.

Yes the test player have the right consequence, but when i use the real account such as

in the facebook development, it can't return the friends any more.


2.png (25.0 KiB)
5 comments
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

Sorry for the delay, I have tried the same thing in my environment:

As you can see the result is correct and I cannot reproduce your issue.

Please make sure Facebook account Yi Yang and Star Rock have been friends and you have logged into one of them(double check the session token). Also check if both of them have the same statistic key. If the current-login account's Facebook access token expired or invalid, you will also be unable to access friends' leaderboard.

In addition, please see this thread as reference.

0 Likes 0 ·
YangYi avatar image YangYi commented ·

Thank you for your reply.

I double checked Yang Yi and Star Rock are facebook friends, and they have logged into playfab.But they aren't automatically add playfab friends each other.

There is something wrong with my facebook login configuration?

0 Likes 0 ·
11.png (54.4 KiB)
brendan avatar image brendan ♦♦ YangYi commented ·

We can only get the friends of a player from Facebook if:

1. The other players have also played this game.

2. The player who is making the request signed in recently with LoginWithFacebook (so that we have a non-expired token from that service).

3. The friends have not set their privacy settings in Facebook to prevent others from seeing their friends.

0 Likes 0 ·
Jens-Stefan avatar image Jens-Stefan brendan ♦♦ commented ·

Hello,

How can we achieve this if we are creating an Instant game and we use "LoginWithFacebookInstantGamesId" to log in?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ YangYi commented ·

It is more like real-time refresh for now. Facebook friend list will only show when player logged in with Facebook, and will be gone after some time (maybe after the facebook access token is expired, I am not very sure of it). And yes, either way they will not be actual PlayFab friends. If you want to add friend and keep the list in PlayFab, you have to add them on PlayFab side with PlayFab way.

0 Likes 0 ·

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]