Login Server Auth, Sessions, And Character Entry
Purpose
The login server owns public account entry: registration, login, refresh, logout, realm discovery, character roster management, character selection, and the first handoff into a game server. It is also the service that applies login migrations and seeds local-development account/character data.
Startup And Readiness
Startup validates secrets and config, connects to Postgres and Redis, runs embedded migrations, upserts realms, optionally seeds development accounts, registers with the control plane, and starts HTTP routes. Readiness should fail if the database, schema, Redis, or draining state is not safe for login traffic.
Public API
The public surface includes registration/login/refresh/logout, realm listing, character listing, character creation, character deletion, and character selection. Character selection prepares handoff data and returns the selected game endpoint information needed by the client.
Session Lifecycle
Login sessions are stored in Postgres and cached in Redis with an expiry. Refresh rotates session state and lookup checks freshness against persistent state. Logout revokes the session so stale access tokens cannot keep creating handoffs.
Login Protection
Usernames are normalized before account lookup or creation. Password hashes are handled through the login support layer. Failed login attempts are throttled, and auth handlers record success/failure audit metrics so operators can distinguish bad credentials from service failure.
Character Entry
Character creation checks name rules, realm ownership, slot limits, and start placement. Default starter characters use deterministic ids derived from account and seed. Starter inventory and currency grants run during character bootstrap so runtime can load consistent economy state.
Handoff Allocation
Character selection asks the control plane for a game assignment when possible. The default game fallback is only for allocator unavailability, not a preferred routing path. Prepared handoff includes trusted account claims, character identity, realm, zone, tile, and runtime placement information.
Operational Signals
Check login readiness, migration logs, failed-login throttle metrics, session cache errors, realm registration, and control-plane assignment failures. If selection succeeds but game entry fails, switch to the session handoff runbook.