Complete authentication context type combining state and actions.

export interface AuthContextType
extends AuthStateContextValue,
AuthActionsContextValue {}
interface AuthContextType {
    authState: AuthState;
    isLoading: boolean;
    error: null | string;
    statusMessage: null | string;
    customCredentials: null | ApiCredentials;
    isOnline: boolean;
    wasOffline: boolean;
    login: (credentials: ApiCredentials) => Promise<void>;
    refreshToken: () => Promise<void>;
    logout: () => void;
    cancelAuth: () => Promise<void>;
    setCredentialSource: (source: "default" | "custom") => void;
    updateCustomCredentials: (
        clientId: string,
        clientSecret: string,
        redirectUri: string,
    ) => void;
    enqueueWhenOnline: (taskId: string, fn: () => Promise<void>) => void;
}

Hierarchy (View Summary)

Properties

authState: AuthState

Current authentication state.

isLoading: boolean

Whether an auth operation is in progress.

error: null | string

Current error message, if any.

statusMessage: null | string

Current status message, if any.

customCredentials: null | ApiCredentials

Current custom credentials, if any.

isOnline: boolean

Current network connectivity status (updated via Navigator Online API and window online/offline events).

wasOffline: boolean

Whether the app was offline during this session (useful for retry logic after reconnection).

login: (credentials: ApiCredentials) => Promise<void>

Log in with credentials.

refreshToken: () => Promise<void>

Refresh the authentication token.

logout: () => void

Log out the user.

cancelAuth: () => Promise<void>

Cancel an in-progress auth flow.

setCredentialSource: (source: "default" | "custom") => void

Set the credential source.

updateCustomCredentials: (
    clientId: string,
    clientSecret: string,
    redirectUri: string,
) => void

Update custom credentials.

enqueueWhenOnline: (taskId: string, fn: () => Promise<void>) => void

Queue a task for execution when online (with deduplication).