question

azhdanov@specialbit.com avatar image
azhdanov@specialbit.com asked

Migrate data from exist PlayFab accout

Hi!
I need some help for solving my problem. I have such case: earlier my application supported only login with facebook accout, but now i want login with Apple device id and link my existing account with facebook id and save or share data previously saved in it with my new account with Apple device Id. So, maybe PlayFab API supporting such feature out the box? I use Unity SDK in my game.

10 |1200

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

brendan avatar image
brendan answered

Yes, if you mean your title used LoginWithFacebook up to this point, all you need to do is use the LinkIOSDeviceID API call to add the device ID to the account. That way, any subsequent attempt to log in with either credential would work to get the player to the same 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.

dcheglakov@specialbit.com avatar image
dcheglakov@specialbit.com answered

Hi, Brendan.

Yes, we've already used LoginWithFacebook to store players data, but now we decided to switch to LoginWithGameCenter, because not all ours players have Facebook account.

How to correctly migrate existing users from Facebook login to Game Center login and link theirs Facebook account to Game Center. Now when we switched to login with Game Center account Facebook account din not link because it already existed.

We want iOS devices players to login with Game Center acoount on game load and if they decide to connect to Facebook they just link this account to Game Center login. 

10 |1200

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

brendan avatar image
brendan answered

The issue is that you already created an account with Facebook, so if you create another new account with GameCenter, that's a different account. So you have a choice:

1. If you want to abandon the data previously saved in the account you created with Facebook, you can just sign into that account separately, unlink the Facebook account from it, and then link it to the GameCenter-linked account.

2. Alternately, you could let them sign into the existing account with Facebook, and then use the LinkGameCenterAccount API call to connect the GameCenter account to it. The player would then be able to sign into that account using either auth mechanism.

3. If you really want to keep the new GameCenter-linked account and move data over, you'll need to sign into both accounts, read the data from the Facebook-linked account, write it to the GameCenter-linked account, then Unlink the Facebook link from the old account and Link it to the new account.

You could also link the Device ID (LinkIOSDeviceID) to the account, so that the player could sign into it without using the Facebook or GameCenter system (though you would still want at least one of those, so that if they switch devices, they can get back to their 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.

dcheglakov@specialbit.com avatar image
dcheglakov@specialbit.com answered

Thanks, Brendan.

We've chosen third way. On game load when player is loging to Game Center we check if the player already has a Playfab ID with Facebook account, copy all his data to Game Center account, unlink Facebook and then link to Game Center account. 

For all new users who only use Game Center we're creating a new user and if they decide to connect to Facebook to compete with their friends we're linking their Facebook account to Game Center.

But with Device ID we've a problem. Here is an example - Player logins on his iPhone with Game Center, links Facebook and Device ID, and make some progress in the game. Then he decides to play on his iPad, but on this device Game Center and Facebook are currently disabled, we're creating Playfab ID for him by Device ID. Then he makes some progress and purchases, after that player decides to login to Facebook or Game Center and at this moment we don't know how to sync data from iPhone (with Game Center  and Facebook accounts linked) and iPad (with Device ID)?

10 |1200

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

brendan avatar image
brendan answered

In the case where a player plays on another device, and you created a new account, you'll have to again decide which account to keep, and which data to merge in. You can link more than one Device ID to the account, but only after unlinking that Device ID from the account it's currently linked to. And please be careful about the order of operations - you must log into the account with the Device ID you intend to unlink before calling the unlink API method, as it will unlink the last Device ID of that type used to sign into the account in question.

10 |1200

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

dcheglakov@specialbit.com avatar image
dcheglakov@specialbit.com answered

Yeah, we already have a pretty complex game logic when players logins and thinking to use Device ID as a guest account.

Thanks again for your time.

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.