question

Hamza Lazaar avatar image
Hamza Lazaar asked

Unity SDK, using Client API for more than one user at a time

Hi,

Is it safe to use client API methods to do a background process for a second user without affecting the main "foreground" user (current logged in one)?

Here is the use case:

I'm saving the different account link status (Facebook, Google, Android DeviceID) in PlayerPrefs. If we detect that DeviceID is linked we connect using it. Otherwise, user must login using another option, once done we try to link DeviceID.

However, if a cache/data is wiped or app is uninstalled and then re installed we may encounter this situation:

1. DeviceA is linked to User1

2. User2 login using a method other than DeviceID, client tries to link DeviceID to account of User2

3. DeviceAlreadyClaimedError ==> backrgound process

4. Background Process:

- connect using DeviceID (User1)

- UnlinkDeviceID (User1)

5. LinkDeviceID (User2)

My question is: can I use SDK methods for background process or should I call HTTP requests using my own code to not risk affecting actual user (here User2)?

I'm under the assumption that some data about logged in user are saved and used internally, like session ticket, CloudScript URL...

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

·
brendan avatar image
brendan answered

Our SDKs all store the Session Ticket, which is specific to the signed-in user, automatically. For the scenario where you find that a user has multiple accounts, and so need to merge some data from one being abandoned to the one that will be the "true" version for the player, you may well need to have multiple accounts signed in at the same time. If so, you'll need to have an alternate means of storing the Session Ticket for the second account, and specifying which you're using in your calls to the service.

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.