Peter Johnson avatar image
Peter Johnson asked

LoginWithCustomIDRequest issue on many devices


About two years ago I made a game utilising PlayFab. I used LoginWithCustomIDRequest for the login, with an option to then register a player name. There are over 350 PC/XBOX users of the game, and about 9000 mobile users. The PlayFab portal shows just under 10,000 players which seems correct... This was made using Unity 2020x.x, Built as a UWP - D3D Type app, with internet client capabilities enabled.

My issue is, in a new game build using Unity 2022, but Built as UWP - XAML, I released a few weeks ago, using the same PlayFab code, but with latest SDK's and in Unity. Of about 30 installs, only about 6 are being registered using the same LoginWithCustomIDRequest system and four of those six logins are me on various devices. Meaning only 2 of 30 real players/customers besides me are getting registered. It's hard for me to test as all my systems work perfectly. What could be going on here? It works perfectly on 100% of my systems. This was frustrating as I made a leaderboard system for the game, as well as a custom Virtual Keyboard system for console players to create a player name once logged in.

Then on another new game just released, it again works perfectly on my systems, but I can see the first person to get my game publicly, failed to login to playfab, yet via MS Partner center can confirm they launched the played the game so I am expecting more issues.. .

As all games are working perfectly on my systems, from both the Unity editor, as Built apps, and even when installed from the Microsoft store onto new computers, I would normally conclude everything is OK, but I know some of the players who are failing to get logged in and I know there is nothing about their networks out of the ordinary.

10 |1200

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

Peter Johnson avatar image
Peter Johnson answered

Found the issue relates to the unique ID exceeding 100. How can I truncate this ?

1 comment
10 |1200

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

Xiao Zha avatar image Xiao Zha commented ·

The SystemInfo.deviceUniqueIdentifier is a unique string, but after truncating, it may not be unique. So, If you want to shorten the length of SystemInfo.deviceUniqueIdentifier while ensuring its uniqueness, you may consider using a hash algorithm (such as SHA-256) to hash it. For example:

 string myString = SystemInfo.deviceUniqueIdentifier;
         string hashedID;
         // Create a SHA256 hash object
         using (SHA256 sha256Hash = SHA256.Create())
             // Hash the device identifier
             byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(myString));
             StringBuilder builder = new StringBuilder();
             for (int i = 0; i < bytes.Length; i++)
                 // Convert each byte to a hexadecimal string and concatenate them
             // Get the final hash string
             hashedID = builder.ToString();

In addition, we recommend adding a recoverable login method for anonymous account so that the players can still login when they change or lose the device.

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

How do you set the CustomId in your code? Could you provide your login system code for us to investigate? Also, there is a 100-character limit on the length of the custom ID, and you may need to add some code to your game to handle cases where the character length exceeds the limit. In addition, the LoginWithCustomId Api is anonymous and contains no recoverable information about the player, you should provide the option to add recoverable login credentials for players.

10 |1200

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

Peter Johnson avatar image Peter Johnson commented ·

Thanks for your response. When you say anonymous, my system logs in with Device ID and then allows user to associate a player name. I am just using it for a leaderboard, but realize the draw bacs. Such as you can only really have 1 player per device.

Some of the code -:

 public void login()
     PlayFabSettings.TitleId = "XXXXX";
     var request = new LoginWithCustomIDRequest

         TitleId = PlayFabSettings.TitleId = "XXXXX",
         CustomId = SystemInfo.deviceUniqueIdentifier,
         CreateAccount = true,
         InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
             GetPlayerProfile = true
     PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnError);

The issue, is 90% of people arent getting their dev ID registered at the very beginning. Yet Id love to know why it works on all of my systems?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Peter Johnson commented ·

I'm using Unity 2022 and building a test project as UWP-XAML but can't find any issues. Is it possible for you to get more error details?

0 Likes 0 ·
Peter Johnson avatar image Peter Johnson Xiao Zha commented ·

Bit tricky, as it works on all of my own computers.. I did note via the API Calls overview that occasionally it says LoginWithCustomIDRequest - invalidparams, but then almost immediately shows LoginWithCustomIDRequest - success., followed by report details, get title data, get leaderboard, etc

But for the people with issues they we are not even getting as far as them having a recorded fail.

I know 2 of the people having this issue. Would there be any logs on their computer do you think ?

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.