On startup, my game logs the user in with LoginWithAndroidDeviceID (or LoginWithIOSDeviceID) automatically with CreateAccount set to true and the game proceeds to the main menu. Say the user links their Facebook account as a recoverable login option. If they get a new device and want to log into their existing account with their Facebook account linked, how would I do that with my current login flow? So the player starts up the game on their new device and a PlayFab account is automatically created and logged in with the new device ID, but they want to restore and login to their previous existing account on their new device. How can I log into another existing account if they are currently logged into the account that was created on anonymous login? I know I will want to link the new device ID to the existing PlayFab account with the Facebook account already linked, but what will happen to the PlayFab account that just got created?
Answer by Sarah Zhang · Aug 14 at 07:07 AM
LoginWithIOSDeviceID and LoginWithAndroidDeviceID are anonymous login mechanisms. It’s not suitable for restoring accounts. So, if we want to restore an existing account on a new device, we shouldn’t create a new account with a new deviceID. Actually, you have linked players’ accounts with Facebook. You can let players use LoginWithFacebook to log in existing accounts. It is a recoverable login mechanism.
So, your current login flow seems to lose such a “log in with an existing account” option. It's not so flexible to always use anonymous login mechanisms when players log in to the game whether or not they have an existing account. You can add a "log in with an existing account" button in your game login panel to let players choose. When they choose “log in with an existing account”, you can let players use LoginWithFacebook to log in existing accounts. If so, your players can restore existing accounts on new devices.
If you want to learn more about LoginWithFacebook, you can check Tutorials Setting up PlayFab authentication using Facebook and Unity and API references here.
Also, here is few things you need to know @Dev TeamSolar:
PS. If you have concern about the device ID of newly created account. You can try:
This may make sure all the device IDs are linked to the same account but I can say it is quite unnecessary.