Sign In Register

How can we help you today?

Start a new topic

Multiple devices authentication (in Unity)

I would like to have my users to have multiple devices safely linked to a unique account without relaying on social accounts. I would basically like something like the Clash of Clans device linking shenanigan to work for my game.

I now log users with GameCenter and GooglePlay but it makes the loading screen extravagantly long.

Would there be a way for me to link different devices to a player account using a GameCenter/GooglePlay login, but only on the first time the game is played on a device.

Afterward, I would prefer to recover the account from the deviceId and not bother about social authentications.

Another idea would be for me to create a username/password for the player, and storing them (with PlayerPrefs) on the device without the player effectively never seeing or knowing their existence. I could do something like that and work a way to send them to additional devices. But the question would then be: how to make it safe? (for both the transferring and the storing on device part)

Hi Gabriel,

If the password is stored in the playerprefs then it would be a challenge to make it safe.

Will investigate this.


Thanks Oisin.

Keep me posted on your thoughts!


I'm looking to implement something similar to what you proposed in the original message. What did you end up doing after all?



I'm sorry to say it is still unresolved in my case. I'm still using GP/GC only. 

My game is in beta so it is not a big problem for now. However I'd be very interested in any GameSparks input on the subject.



I was considering using Google Play and Game Center as well, but asynchronously. Basically, log in the user with DeviceAuthenticationRequest at launch. Whenever I get the call back from GP/GC about the user being logged in, then I'd call GooglePlayConnectRequest (or game center). From the documentation, it looks like all the scenarios are handled (adding to current account, creating a new account, etc).

It would indeed be nice to have a best practice scenario for mobile games, including cross-platform support.

Is it possible to retreive an account with DeviceAuthenticationRequest if this account has a GP/GC profile linked to it? 

I was under the impression it was not possible. But I'm re-reading the documentation now and it seems it is only impossible if a username/password account is created. It should be simple enough to test this when I get some time in the next few days. 

I think that would be part of a good solution.

I am stuck trying to get GP connection to work (where to get the auth token from!?), but I did test on the Test Harness that you can take a DeviceAuthenticationRequest account and call ChangeUserDetailsRequest("newPassword"="toto", userName="userTest") to transform it into a plain normal account. My guess is that the same is true for the other types of account as well. After all, they all are stored in the same table. The only difference is which fields they have.

After managing to get Google Play connections to work, I've been doing some testing and it appears to work.

Yes, it is possible to retrieve an account with DeviceAuthenticationRequest that has a GP profile linked to it. The "magic" with DeviceAuthentication is that it sets the username to a specific string based on the device id (plus some other stuff). Linking a profile with GP doesn't change that username, so the system still can find it.

Also, make sure to use .SetSwitchIfPossible(true) when calling GooglePlayConnectRequest as otherwise you may get Account_Already_Linked errors if the player switches between different Google Play accounts on the same device.

Now to test with GC... 

Login to post a comment