Skip to main content
Flock authentication has two layers, and the SDK handles both:
  1. Game — the SDK authenticates your game with the credentials you configure once (API Key, Game ID, Game Version). Every request it makes is then identified as your game.
  2. Player — players sign in through the SDK, which then manages their session automatically for the rest of play.

Configure your game

Set your credentials in your engine’s settings. The editor also verifies the connection and resolves your Game Version, both required before the SDK can start.
Credentials live in Flock → Settings — see Unity setup.With Auto-Initialize On Load the SDK authenticates as your game at startup; turn it off to initialize it yourself. Reach everything through FlockClient.Instance.

Sign in a player

Players sign in with one of several methods. Each resolves to the same player account, and the SDK keeps them signed in afterward.
Every method is a LoginWith…Async call on FlockClient.Instance.Authentication. They throw FlockException on failure, so wrap them in try/catch to give bad credentials or a dead network a clean retry path.
For the platform methods the SDK exchanges a credential your platform SDK already produced; it does not obtain one for you. Google wants an ID token, Apple an identity token, Steam a session ticket.Registering is a separate call. Logging in never creates an account, so a new player needs RegisterWith…Async first. A successful register also signs the player in, so no login call follows on the happy path.Registering an identity that already has an account is not an error — the call returns null and leaves the player signed out, so follow that case with a login:
Afterward, read FlockClient.Instance.CurrentPlayerId or handle FlockEvents.OnAuthenticated.Picking a display name? Check it’s free first — advisory, since another player can still claim it in between:

Password reset

For email/password accounts, a two-step emailed-code flow. The first call always succeeds — it never reveals whether an email is registered. Resetting requires the current session to have been signed in with email — a device or Steam session cannot reset a password it never had.

Email verification

Optional, code-based, and always under your control — the SDK never sends verification emails on its own. Typically used while the player is signed in (their session is attached automatically), but neither call blocks on it.

Signing out

Logout clears the session on the device — the standard client sign-out. For shared devices or a compromised session, revoking additionally kills the player’s session server-side, so a stolen session token stops working.

Sessions are managed for you

Player sessions are short-lived under the hood, but the SDK refreshes them automatically — you don’t have to think about tokens or expiry. If a player needs to sign back in, the SDK raises OnAuthExpired on its event hub.