Multiplatform - One Account?

Hello, I was planning to allow my users to play without needed to sign in initially, aka: device id. Once there is a reason to log in, for example, IAP, or perhaps after a certain amount of time or accomplishment, I would prompt the user to log in to save progress, or log in before purchase, etc.

So far I have login working for Google Login:Releases · googlesamples/google-signin-unity · GitHub
I also have it working for Steam. I haven’t set up ios yet, but plan to once there is something worth testing on a device.

The question/issue I have, is how do I allow the user to log in from more than one machine? If I log in with Steam on my PC, how does their Google Login on their phone know about their account?

I’ve seen the ‘LinkAsync’ methods, so I’m assuming I’d have to somehow log in as one account, then link async the other account, but not really sure how to first get access to the account on the ‘other’ device.

I also read through this:Tutorial: Making a Multiplayer Game with Nakama and Unity: Part 3/3 - The Knights of Unity

But I think this is where you are trying to transfer an account from one device to another device, logging in with the same platform. I want to be able to log in with multiple platforms (not at the same time). I want to be able to play on my PC through Steam login, then on my mobile device if I’m waiting in line somewhere, etc. with Google Login.

Any advice is welcome.

I have been thinking on this for a while, and may have come up with a solution.

  1. User logs into new platform, and has the option to link existing account.
  2. User is directed to go to old platform, and choose option to generate ephemeral link id.
  3. Server generates a key-value: key = link id, value = nakama account id.
  4. The link id is revealed to the user for x time (1 hour or something)
  5. User goes to new platform, and enters the link id.
  6. Server validates the link id, and links the account to the new platform.

There will be some things to work through, like deleting the account originally created by logging in as the new platform, removing the key/value once used, etc. But this seems like a solid way to do it. I thought of it while linking a new Smart TV to my wifes phone. They seem to do this exact system.

1 Like

@Bunzaga This sounds like a good solution because ultimately unless you can sign-in with the identity provider across the different platform your game is distributed on you must rely on the player to provide the authenticity guarantee through a trust key which is what you’ve called the “link id”.

@novabyte Thank you for responding.

I was looking at the data available and the various ‘link’ options, and was worried I wouldn’t be able to do this, if all I have access to is the “User ID”. You mention the concept of a ‘trust key’. Perhaps this is what I should store in place of the Nakama User Id?

How I imagine it, is the server would generate a unique 6 digit alpha numeric ‘link id’, and use this to reference the authenticated existing account in the database(via trust key?). When the user logs into the other(new) platform, they would enter this 6 digit number, and the server would know to link the new platform to the existing account via some back end reference, which would be the ‘trust key’ I think.

After successful link, the server would have to delete the now un-attached ‘ghost’ account, and remove the link id and trust key from the database.

Do you have an example of how to reference or use the trust key?

@Bunzaga I think I overcomplicated my terminology for this work. You should be able to generate an 8 number or characters ID which we’ll call the “trust key”. You would then use this value to display to the user and have them input it on a second device.

The value itself would just be stored as a device ID in the server via the LinkAsync option. Then on the second device the AuthenticateDeviceAsync option would be used with the value input by the user. It would be under some kind of UI menu option “Attach New Device” or similar.

Hope that helps.