Preston Phillips avatar image
Preston Phillips asked

1 xbox account linked to 2 playfab master accounts and unique names

We're currently using Playfab for online functionality between Win10 store and Xbox. As such we are logging into Playfan using an Xbox token. Once logged in we set the users display name to the Xbox gamertag name to allow us to get the name of the players we join since we've not found a way to do this through the Microsoft GDK.
Our problem is that when a player logs in on PC and then on Xbox it seems to create separate Playfab 'Master player accounts' for them both with the same linked xbox live account. This means when we try to set the display name we get an error because the name is no longer unique and has been taken by the other master player from the PC sotre login.
Should our solution be to enable non-unique usernames in the Playfab title settings or is there a better way for us to handle this scenario?
For reference our login properties are:

var request = new PlayFab.ClientModels.LoginWithXboxRequest();
request.CreateAccount = true;
request.XboxToken = XboxToken;
request.InfoRequestParameters = new PlayFab.ClientModels.GetPlayerCombinedInfoRequestParams();
request.InfoRequestParameters.GetPlayerProfile = true;
request.TitleId = titleID;
PlayFab.PlayFabClientAPI.LoginWithXbox(request, OnPlayfabLogin, OnPlayfabFailed);

If we are using the display name correctly but are not to enable non-unique usernames how should we handle the situation where a user changes their gamer tag and another user takes their old freed gamer tag? If they try to play before the original user updates their display name it will flag as not unique.

Player Dataunity3dAccount ManagementTitle Datamultiplayer
10 |1200

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

1 Answer

brendan avatar image
brendan answered

Actually, the reason two different player account were created is because those two sign-ins were from different Xbox Live Sandboxes. I found an example of two player accounts in your game that were in this state. One originated from Sandbox ZJHDMN.99, while the other was from ZJHDMN.0. For a live game, all sign-ins would be coming from Xbox Live Production, which is a single sandbox. So regardless of the client device, a single Xbox Live player would always sign into the same PlayFab account.

10 |1200

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

Preston Phillips avatar image Preston Phillips commented ·

Ok so we should leave the name settings as they are and clear the accounts created in sandboxes.
What about handling users that change gamer tags to tags that have been used by other users in the past?

0 Likes 0 ·
brendan avatar image brendan Preston Phillips commented ·

Ah, right - sorry, I should have addressed the overall use case, as well.

My quick take on it would be that I wouldn't copy the Gamertag to the DisplayName unless you have a very specific need for that, and you're okay with turning on the non-unique DisplayName option (making it no longer a searchable element). While you could just check the Gamertag on login and change the DisplayName if it has changed, that wouldn't help for the case where someone changes their Gamertag but then doesn't sign in to the title after that. You can get the Gamertag as part of a call to get the player's account info, so you can still access it.

Technically, knowing that Gamertags are unique, you could have an Azure Functions Cloud Script that you run to set the user's DisplayName, and which does the query for the player that currently has the DisplayName matching the Gamertag if one exists, forcibly changing that one to a randomly generated ID. But I'd like to make sure it's worth you going to that trouble, first. What's your specific use case?

1 Like 1 ·
Preston Phillips avatar image Preston Phillips brendan commented ·

We are currently just using the display name as a way to get the other players gamer tags to show in game. We get the account info in order to get the other users xbox ID but can't find a way to get their gamer tag using GDK and that ID so ended up using the display name as a quick solution.

We don't do anything fancy and don't search for accounts using display names so setting the non unique is an option but if there is a better way prefer to use it.

0 Likes 0 ·
Show more comments

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.