AuthSessionInitializer

class AuthSessionInitializer(authRepository: AuthRepository, authTokenProvider: AuthTokenProvider, sessionStore: AuthSessionStore, logger: KommonLogger = NoOpLogger, scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default))

Warms the auth session at cold start: mints/refreshes a token before the first API request can race an unauthenticated call, then keeps sessionStore updated as AuthRepository.authStateFlow changes. Call start early in app startup and stop when its owning app scope is torn down.

Constructors

Link copied to clipboard
constructor(authRepository: AuthRepository, authTokenProvider: AuthTokenProvider, sessionStore: AuthSessionStore, logger: KommonLogger = NoOpLogger, scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default))

Functions

Link copied to clipboard

Starts session warming and observation. Repeated calls while running are ignored.

Link copied to clipboard

Stops this initializer's work without cancelling the caller-owned scope.