Auth Bootstrap (Safe Startup Login)
Goal
Authenticate once per session (silent first, then optional interactive) and keep listening for auth status changes.
Why this use case exists
GameServicesAuthenticate.successEvent means the request was dispatched, not that the player is authenticated. Always wait for GameServicesOnAuthStatusChange.authenticatedEvent before calling authenticated-only actions.
Actions used
GameServicesOnAuthStatusChange(persistent listener)GameServicesIsAuthenticated(quick check)GameServicesAuthenticate(dispatch)GameServicesGetAuthenticateError(optional diagnostics)GameServicesGetLocalPlayerInfo(optional player info after authenticated)
Flow
State (persistent):
AuthListenerAction:
GameServicesOnAuthStatusChangeEvents:
authenticatedEventβAuthenticatedauthenticatingEventβ (optional)AuthenticatingnotAvailableEventβAuthUnavailable
State:
StartupCheckAction:
GameServicesIsAuthenticatedβisAuthenticatedIf
trueβAuthenticatedIf
falseβSilentAuthenticate
State:
SilentAuthenticateAction:
GameServicesAuthenticate(interactive = false)failureEventβAuthUnavailablesuccessEventβ stay in flow and wait forAuthListenerevents
State:
AuthUnavailable(Optional) Action:
GameServicesGetAuthenticateError(logerrorDescription)Decide UX:
Continue without Game Services
Or show a βConnectβ button β
InteractiveAuthenticate
State:
InteractiveAuthenticate(optional)Action:
GameServicesAuthenticate(interactive = true)Wait for
AuthListener.authenticatedEvent
State:
Authenticated(Optional) Action:
GameServicesGetLocalPlayerInfo(display name, player id)
Notes
Keep
AuthListeneractive for the whole session. Auth status can change at any time.If you gate achievements/leaderboards behind login, route those flows to
InteractiveAuthenticatewhen needed.
Last updated
Was this helpful?