Tutorial: Auth + Session Lifecycle¶
Objective¶
Build a robust startup auth flow with automatic refresh and explicit logout handling.
Flow¶
- Initialize DI and
SessionManager restoreSession()on launch- Subscribe to
sessionState - Route app shell based on authenticated vs unauthenticated state
- On sign-out, call auth sign-out then
clearSession()
State handling¶
Loading: show blocking startup stateAuthenticated: continue to appExpired: attempt refresh + fallback to sign-inNotAuthenticated: show sign-in