Authentication state snapshot

Represents the current authentication state of the application. This is useful for components that need to react to auth state changes.

Example

// Subscribe to complete auth state
this.authState$ = this.authBase.getAuthState();

this.authState$.subscribe(state => {
if (state.isLoading) {
this.showLoadingSpinner();
} else if (state.isAuthenticated && state.user) {
this.showWelcomeMessage(state.user.name);
} else if (state.error) {
this.showError(state.error.userMessage);
}
});
interface AuthState {
    error?: StandardAuthError;
    isAuthenticated: boolean;
    isLoading: boolean;
    user?: StandardUserInfo;
}

Properties

Current error (if any)

Present if there was an error during authentication or token refresh.

isAuthenticated: boolean

Whether user is currently authenticated

isLoading: boolean

Whether auth state is still being determined

True during initial authentication check or token refresh. Useful for showing loading spinners.

Current user info (if authenticated)

Undefined if not authenticated or still loading.