Not translated yet — showing English.
User Login
Every player starts as an anonymous player, and signs in with a provider when they want to keep their account. PlayServ.Connect() creates the anonymous player on the first launch and restores it on the next ones. Signing in with Apple, Google, Facebook, Epic or Steam then attaches that provider to the same player, so nothing the player did as a guest is lost.
using Playserv.Identity;
using Playserv.Wrapper;
using UnityEngine;
// After PlayServ.Connect(): attach Google to the current player.
var result = await PlayServAuth.LoginExternalAsync(PlayServExternalIdentityProof.FromGoogleIdToken(idToken));
if (result.Status == PlayServAuthOperationStatus.Success)
Debug.Log($"Signed in as {PlayServAuth.PlayerId}");
The providers your players can use are switched on for the project in SSO & Auth.
Anonymous players
When the game connects with a client key, the SDK signs in an anonymous player: a new one on the first launch, the saved one after that. Nothing else is needed. See Connection & Session for how the session is kept.
| Property | What it tells you |
|---|---|
PlayServAuth.IsLoggedIn | Whether a player is signed in. |
PlayServAuth.PlayerId | The player's PlayServ ID, plr_…. It stays the same when providers are added. |
PlayServAuth.SessionKind | Anonymous, or Registered once a provider is attached. None before sign-in. |
PlayServAuth.CurrentSession.LinkedProviders | The providers attached to the player. |
Set AnonymousDisplayName on the SDK settings from code, before connecting, to name a new anonymous player, including the one created after a sign-out. It doesn't rename an existing one.
Sign in with a provider
Get the player's token from the provider, turn it into a proof, and pass it to LoginExternalAsync.
| Provider | Proof | Companion package |
|---|---|---|
| Apple | FromAppleIdToken(idToken, nonce) | com.playserv.apple-signin, using Sign in with Apple on iOS |
FromGoogleIdToken(idToken, nonce) | com.playserv.google-signin, on top of the Google Sign-In plugin for Unity | |
FromFacebookLimitedLoginToken(token, nonce); the nonce is required | com.playserv.facebook-login, using the Meta SDK's Limited Login | |
| Epic | FromEpicExternalAuthToken(token) | com.playserv.epic-auth, using the EOS plugin for Unity |
| Steam | FromSteamTicket(ticket) | com.playserv.steam-auth, using Steamworks.NET |
The companion packages are optional helpers that get the provider's token for you; you can also build the proof from a token you already have. Install and switch them on in Tools ▸ PlayServ ▸ Settings, under the SDK module settings. Add .WithDisplayName(name) to a proof to name the player when the account is first created or linked.
LoginExternalAsync(proof, mode) decides what happens to the current anonymous player. mode is a PlayServExternalLoginMode:
| Mode | Use it when | What happens |
|---|---|---|
PreserveCurrentPlayer (default) | The player is signing in on the device they've been playing on. | The provider is attached to the current player, who keeps their ID and progress. |
RecoverProviderAccount | The player is restoring their account on a new device. | The player who owns that provider account replaces the anonymous one. |
The result's Status is Success, Conflict or Failed. A conflict means the provider account already belongs to another player: the current player is kept, and result.Conflict describes the other one, so you can offer to merge or to switch. A successful sign-in reconnects the game with the new session.
PlayServAuth.GetProvidersAsync() lists every provider with its Enabled and Available flags; offer the available ones on your sign-in screen.
Sign in through the browser
PlayServAuth.LoginBrowserAsync(provider, options) signs the player in on the provider's own web page, in WebGL, desktop builds and the Editor. WebGL opens a popup, desktop and the Editor the system browser. The SDK waits up to 5 minutes for the player to finish.
| Rule | Why |
|---|---|
| In WebGL, call it straight from a click handler. | Otherwise the browser blocks the popup and the result is BrowserPopupBlocked. |
| Run one browser sign-in at a time. | A second one returns BrowserFlowInProgress. |
Set AllowPlayerSwitch = true to let it switch players. | If the provider account belongs to another player, the result is BrowserPlayerSwitchRequired unless you allow the switch. |
Browser sign-in never links or merges accounts.
Link, unlink and merge
| Call | What it does |
|---|---|
LinkIdentityAsync(proof) | Attaches another provider to the current player. A player has one account per provider. |
UnlinkIdentityAsync("google") | Removes a provider. The last one can't be removed. |
MergeIdentityAsync(conflict, choice, freshProof) | Joins the current player and the one from a conflict into one. choice is PlayServMergeChoice.KeepCurrentPlayer or UseConflictingPlayer; freshProof is a new proof for the provider in conflict. |
A merge moves sign-ins, not progress
The providers of the merged player move to the one that remains. The merged player's progress, purchases and records stay with it and are not copied.
The player's profile
PlayServAuth.GetCurrentPlayerProfileAsync() returns the signed-in player's own profile, loading it once; RefreshCurrentPlayerProfileAsync() loads it again.
Sign out
PlayServAuth.LogoutAsync() ends the session on the platform, clears it on the device, and signs in a new anonymous player. If the platform couldn't be told, the result's error says so; the device is signed out either way.
When sign-in fails
Failures come back in the result's Error. Only these throw: cancellation, a missing or invalid argument, and a call while the game is connecting or reconnecting.
| Error | When | What to do |
|---|---|---|
ProviderAlreadyLinked | The provider account belongs to another player. result.Conflict is set. | Offer to merge, or to switch to that player. |
ProviderNotLinked | Unlinking a provider the player doesn't have. | — |
LastProviderUnlinkForbidden | Unlinking the player's last provider. | Link another provider first. |
MergeProviderConflict | Both players have an account of the same provider. | Unlink one of them, then merge. |
DeviceBanned | This device is banned. | Tell the player; signing in again won't help. |
Forbidden | The player is banned or suspended: Error.BackendCode is player_banned or player_suspended. | Tell the player. |
InvalidCredential · Unauthorized | The provider's token was rejected or has expired. | Get a new token from the provider and try again. |
Ban and suspension are final for this sign-in
A banned device or account can't sign in until an operator lifts it in Players. Don't loop on retries.
If the platform ends the session later, for example after a ban, PlayServAuth.SessionLost fires: see Connection & Session.
Using your own authentication server, through PlayServ Auth Token or PlayServ Webhook, is coming soon.
Next steps
- SSO & Auth — switch on the providers and enter their credentials
- Managing Players — the accounts your players get
- Connection & Session — how the session stays alive and when it ends
Last updated on 19 Oct 2026