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 — Flock → Settings in Unity, Project Settings → Plugins → Flock SDK in Unreal. The editor also verifies the connection and resolves your Game Version, both required before the SDK can start (see setup for Unity or Unreal). 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 in Unity, or UFlockSubsystem::Get(this) in Unreal.

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.
Failures surface differently per engine. Unity throws FlockException; Unreal returns a TFlockResult you check, because Unreal builds with exceptions off. Every Unreal call is also a Blueprint node with an On Failure pin.
Registering and signing in are separate calls, in both SDKs — logging in does not create an account, and registering does not sign the player in. Use RegisterWith…Async (Unity) or RegisterWith… (Unreal) for the sign-up step. Registering an identity that already has an account is reported as a success, flagged so you can route the player to a login rather than show them a failure. In Unreal, Facebook and Discord are login-only — an account must already exist. Afterward, read FlockClient.Instance.CurrentPlayerId (Unity) or Flock Get Player Id / GetPlayerId() (Unreal), or handle the OnAuthenticated event. 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, RevokeTokenAsync() 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.
Handle sign-in failures so you can show a clean retry path for bad credentials or a dead network. In Unity wrap the call in try/catch for FlockException; in Unreal check Result.bSuccess, or wire the node’s On Failure pin.