# Login Scene ## UI - Connection status indicator (connecting/retrying/failed) - Retry action + diagnostics link (optional) - Username/email field - Password field - Remember device toggle - Submit + Forgot Password actions - `Create Account` action to open `Register` - OAuth provider buttons (Google/Steam/Apple/Microsoft as enabled) - Session check/loading indicator - OAuth status text + callback verification state ## Client - Open hub/relay connection in this scene. - Send initial hello with client build/platform metadata. - Wait for connection acceptance and service availability. - Perform session probe after connection is established. - Decide path: existing session refresh, password login, or OAuth login. - Start OAuth flow and handle OAuth callback exchange in this scene. - Route `Forgot Password` to account recovery flow. - Route `Create Account` to `Register`. - On success transition to `MainMenu`. ## Server - Validate protocol compatibility and return environment capabilities. - Return service status. - Validate refresh tokens and return auth policy. - Validate credential login. - Generate OAuth start URL/state and process OAuth exchange. ## Data Exchange ### Client -> Server (`HubHello`) - `requestId`, `clientVersion`, `contentVersion`, `platform`, `locale`, `deviceId`, `sessionId` ### Server -> Client (`HubWelcome`) - `requestId`, `connectionId` - `minSupportedClientVersion`, `latestClientVersion`, `latestContentVersion` - `serviceStatus`, `apiBaseUrl`, `cdnBaseUrl` - `authProvidersEnabled`, `motd` (optional) ### Client -> Server (`SessionProbe`) - `requestId`, `refreshToken` (optional), `deviceId` ### Server -> Client (`SessionProbeResult`) - `requestId`, `isAuthenticated`, `accountId`, `displayName` - `authMethodsAvailable`, `passwordPolicy` ### Client -> Server (`LoginRequest`) - `requestId`, `emailOrUsername`, `password`, `deviceId` ### Server -> Client (`LoginResponse`) - `requestId`, `success`, `accessToken`, `refreshToken`, `expiresAtUtc`, `accountSummary`, `errorCode` ### Client -> Server (`OAuthStartRequest`) - `requestId`, `provider`, `returnUri`, `deviceId` ### Server -> Client (`OAuthStartResponse`) - `requestId`, `authorizationUrl`, `state`, `codeVerifier` (if PKCE client-managed) ### Client -> Server (`OAuthExchangeRequest`) - `requestId`, `provider`, `authorizationCode`, `state`, `codeVerifier` ### Server -> Client (`OAuthExchangeResponse`) - `requestId`, `success`, `accessToken`, `refreshToken`, `expiresAtUtc`, `accountSummary`, `errorCode`