question

laurentiumarianivan avatar image
laurentiumarianivan asked

Register more accounts on the same device

Hello everyone!
I tried modifying the code provided in the Authentication Playfab series on youtube to allow me to add more accounts using the same device.
So for example the user registers an account and plays with that one, but after a time maybe he wants to make another one. Right now he can't do that because SilentlyAuthenticate sees that there is already an account registered on that device ID.
Any workaround for this?
Thanks a lot!

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

·
Seth Du avatar image
Seth Du answered

If you are using LoginWithIOSDeviceID or LoginWithAndroidDeviceID for Silent Authentication.

A work around solution is using LoginWithCustomID instead for the same purpose. After you retrieve the device ID, you can modify custom ID via append randomly generated string to device ID. Of course, you can add more variables (for example, time, geographic information, index of existed accounts) when the generation if there are concerns for safety.

But generally speaking, custom ID is always a low priority solution if there’s a pre-existing ID on their client device. Any account that binds with device is unique under normal circumstance.

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.

laurentiumarianivan avatar image laurentiumarianivan commented ·

Thanks a lot for answering! So replacing LoginWithAndroidDeviceID with this piece of code should work? RandomString() returns a 15 character random string.

 PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest()
            {
                TitleId = PlayFabSettings.TitleId,
                CustomId = SystemInfo.deviceUniqueIdentifier,
                CreateAccount = true,
                InfoRequestParameters = InfoRequestParams
            }, (result) => {
                _playFabId = result.PlayFabId;
                _sessionTicket = result.SessionTicket;
                if (callback == null && OnLoginSuccess != null)
                {
                    OnLoginSuccess.Invoke(result);
                }
                else if (callback != null)
                {
                    callback.Invoke(result);
}
            }, (error) => {
                if (callback == null && OnPlayFabError != null)
                {
                    OnPlayFabError.Invoke(error);
}
                else
                {
                    callback.Invoke(null);
                }
            });
0 Likes 0 ·
laurentiumarianivan avatar image laurentiumarianivan commented ·

Sorry for the double post, the CustomId is actually:

CustomId = SystemInfo.deviceUniqueIdentifier + RandomString();
0 Likes 0 ·
brendan avatar image brendan laurentiumarianivan commented ·

I'd actually recommend not using Custom ID, as you will definitely want to go back to using the device-specific ID for login for your shipping title. Under the covers, the ID (regardless of which one you use) is just an arbitrary string. So for your testing, you could take the ID of the device and add a random number to it, or an incrementing number even (depending on how you want to manage it in the client).

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.