Sign in with System ID?

Hello, I am trying to setup Authentication for my profile system in a unity demo.

However, I ran into a problem early where the AuthenticationService.Instance.PlayerId changes when I clear playerprefs and try to login again using AuthenticationService.Instance.SignInAnonymouslyAsync().

I do this to simulate a player installing and reinstalling the app yet still holding their old information.

I understand you can save data using a linked service like apple, google, fb or steam but what is this 5th option to login using SignInWithExternalTokenAsync()?

Is this something where I can use the SystemInfo.deviceUniqueIdentifier to login instead?

This is what I try to do right now.

ExternalTokenRequest etr = new ExternalTokenRequest();
etr.IdProvider = “Device”;
etr.Token = SystemInfo.deviceUniqueIdentifier;

await AuthenticationService.Instance.SignInWithExternalTokenAsync(etr);

I get the following error when I do so.

[Authentication]: Request failed: 400, {“title”:“INVALID_PARAMETERS”,“detail”:“invalid identity provider”,“details”:[ ],“status”:400}

Am I using it wrong? If so, how do I make sure the user is anonymously logged into the same account on the same device whenever they log in?

Hey Eleven,

I’d have to dig around the code to get a 100% answer on this, but my 95% answer is that the “SignInWithExternalTokenAsync” method is the generic method that all specific service providers use, with the appropriate parameters passed in.

There aren’t any external providers that the method there could consume that aren’t serviced by their dedicated methods.
I’ll raise this with the devs to validate the above and let you know the outcome.

Hey Eleven,

Turns out that was super easy to confirm - the function is not meant to be used directly by developers and its there for add on packages.
We’re going to look in to how to make things less confusing for the next release, so others aren’t also confused by the method.

Hope this helps!

Oh alright. Thank you for clearing it up :smile:

@unity_Ctri Is there a way to track the anonymous login by device ID? I’m guess “no” is the answer.

Does Anonymous login use the same ID, on the same phone/app across app sessions? So a user can keep progress so long as they don’t uninstall/reinstall the app. I’m guessing “yes”.

Can you comment on the above?^^^^

IMO–It would be nice for UGS to support anonymous player tracking by device ID. Other game services (such as Play Fab) so this.

You are right about Anonymous login use the same ID for the same phone/app as long as the user don’t uninstall/reinstall the app.

I don’t really see a use for anonymous sign in. If they delete the app, the data is gone. If they move devices, its gone. whats the point? Just save local and its the same thing. Is there any reason I am missing to use this sign in?

1 Like

It’s more of a bridge to signing in with a platform.

So, you have the anonymous user data synced with whatever local data you’re saving. At some point in the game, the player can link a platform (ie Apple Game Center) in which case the anonymous user is now an Apple Game Center user. All their data is linked to their Apple Game Center account, so if they delete the app or open it on a new device, they can choose to Sign in with Apple Game Center and have all their save data loaded.

So yes, on it’s own anonymous sign in doesn’t have any advantages, but it’s true power is in linking other platforms.

Thanks for writing!

I guess the ONLY thing I can see the advantage is that if you somehow lose your local data but use the same device, you can get it back using the anonymous account. (I think)

Right, but I don’t even do that. I just link it. Example: SignInWithAppleGameCenterAsync. I don’t need a anonymous account.

But maybe I am wrong! Thanks for pointing the info out :slight_smile: