question

tourtellotronald2020 avatar image
tourtellotronald2020 asked

How to log into original account on reinstall or new device?

So I followed the documentation to a degree for account log in basic practices.

1. I log player in using anonymous login method associated with their device.

2. I at a later point, direct them to adding an account email and password for recovery.

3. If they do, the account is correctly linked with the credentials provided.

Now what my issue is, what happens when a user has a fresh start. Currently, it will just log them in with their device ID which would be new and create a new account. In theory i think i can have them log in with their original credentials, but even if I learn how to do this, which i eventually will, with my current implementation it will log in using the new ID every time on start up and they'd have to relog in. Not sure how to go about signing into their correct account silently every time on start up. I read that i shouldnt be storing their email and password in PlayerPrefs so not sure how to login with email and password without that.

(I know this question has been asked a few times over the years but none of the answers given helped me which is why I'm asking now).

I presume there needs to be some check of a playerpref to know whether i should login with their device id or not. But not sure where to go past there without storing their password and email locally.

unity3dAccount ManagementAuthenticationdocumentation
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

·
Made Wang avatar image
Made Wang answered

For logging in with a device ID, when a new device ID is used, a new account will be created and logged in with the new account. We call this login method anonymous login, players usually do not know the specific device ID, so we recommend that when players play for a period, they are prompted to link this account to a third-party account or add an email and password. In this way, when players change devices, they can log in to their original accounts with their email addresses and passwords.

When you call LoginWithEmailAddress to log in on the new device, you can link the device ID of the new device with the current account, so that on the new device you can use the new device ID to log in instead of entering the email address and password every time, which we call silent login.

To clarify, PlayerPrefs is a method used in Unity to store some data locally, and Unity does not recommend storing sensitive information such as passwords in PlayerPrefs, refer to Unity - Scripting API: PlayerPrefs (unity3d.com).

About what is anonymous login, how to link new device ID, how to implement silent login, you can refer to Account linking quickstart - PlayFab | Microsoft Docs.

Also, you can refer to this example to further refine your login method.

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.