Session sync errors
Typed errors and UI helpers when /api/auth/session fails or blocks the shell.
Module: @sumx/ssr-auth-core/session-sync-errors
Types (auth-session-types)
| Type | Purpose |
|---|---|
ServerSessionState | unknown | present | absent |
ServerSessionCheckResult | Result of verify call |
AuthUiErrorState | Title + message for error shell |
CrossTabSessionDialogState | Another tab signed in |
AuthSessionSyncError | Error with code, status, fatal flags |
SyncServerAuthSessionOptions | Client sync options |
VerifyServerSessionOptions | Verify options |
Factory & parsers
| Function | Description |
|---|---|
createAuthSessionSyncError(code, opts?) | Build typed sync error |
getAuthSessionErrorStatus(error) | HTTP status if present |
getAuthSessionErrorMessage(error, fallback?) | Safe user message |
isFatalAuthSessionError(error) | Should not retry silently |
isBlockingAuthUiError(error) | Blocks main UI (show shell) |
createAuthUiErrorState({ error, ... }) | Map to AuthUiErrorState |
Usage in CheckToken
@sumx/ssr-auth-react uses these to decide:
- Show retry vs sign in again
- Open Dialog for cross-tab session
- Clear cookies via portal
cookieUtils
Example
import {
isBlockingAuthUiError,
createAuthUiErrorState,
} from '@sumx/ssr-auth-core/session-sync-errors';
if (isBlockingAuthUiError(err)) {
setUiError(createAuthUiErrorState({ error: err }));
}Do not log raw tokens when handling errors.