Askr documentation
Generated API snapshot

@askrjs/auth/server

Exports from the declarations published in @askrjs/auth. Signatures reflect the published artifact.

Exports

This entrypoint publishes 11 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

createOidcProvider

createOidcProvider: (options: OidcProviderOptions) => ProviderDefinition

createProviderSession

createProviderSession: (options: ProviderSessionOptions) => ProviderSession

Confidential provider sessions share one atomic authority and one application cookie.

InteractionRequiredError

InteractionRequiredError: typeof InteractionRequiredError
code
readonly code = "interaction-required";
reason
readonly reason: "login" | "consent";
provider
readonly provider: string;
resource
readonly resource?: string;
scopes
readonly scopes: readonly string[];

OidcProviderOptionstype

OidcProviderOptions: any
id
readonly id: string;
issuer
readonly issuer: string;
clientId
readonly clientId: string;
clientAuthentication
readonly clientAuthentication: ProviderClientAuthentication;
identityScopes
readonly identityScopes?: readonly string[];
responseMode
readonly responseMode?: "query" | "form_post";
capabilities
readonly capabilities?: Partial<ProviderCapabilities>;
authorizationParams
readonly authorizationParams?: Readonly<Record<string, string>>;
endpoints
readonly endpoints?: { readonly authorization?: string; readonly token?: string; readonly jwks?: string; readonly logout?: string; readonly revocation?: string; };

ProviderDefinitiontype

ProviderDefinition: any
id
readonly id: string;
issuer
readonly issuer: string;
clientId
readonly clientId: string;
clientAuthentication
readonly clientAuthentication: ProviderClientAuthentication;
responseMode
readonly responseMode: "query" | "form_post";
identityScopes
readonly identityScopes: readonly string[];
capabilities
readonly capabilities: ProviderCapabilities;
authorizationParams
readonly authorizationParams?: Readonly<Record<string, string>>;

ProviderSessiontype

ProviderSession: any
resolve
Resolve the principal, session, tenant, and authorization state. Invalid bearer and cookie JWTs fall through as unauthenticated; tenant and store failures propagate.
login
login(request: Request, options: ProviderLoginRequest): Promise<Response>;
callback
callback(request: Request, options: { readonly provider: string; }): Promise<Response>;
logout
logout(request: Request, options?: ProviderLogoutRequest): Promise<Response>;
token
token(request: Request, provider: string, options: ProviderTokenRequest): Promise<string>;
finalize
finalize(request: Request, response: Response): Promise<Response>;
close
close(): Promise<void>;

ProviderSessionError

ProviderSessionError: typeof ProviderSessionError
code
readonly code: ProviderSessionErrorCode;

ProviderSessionErrorCodetype

ProviderSessionErrorCode: "configuration" | "invalid-callback" | "invalid-transaction" | "session-oversize" | "capacity" | "store-unavailable" | "provider-unavailable" | "closed"

ProviderSessionOptionstype

ProviderSessionOptions: any
origin
readonly origin: string;
providers
readonly providers: readonly ProviderDefinition[];
session
readonly session: { readonly secrets: readonly string[]; readonly store?: ProviderSessionStore; readonly maxAgeSeconds?: number; readonly leewaySeconds?: number; readonly maxEntries?: number; };
onSignIn
readonly onSignIn?: (context: { readonly provider: string; readonly principal: Readonly<Principal>; readonly profileHint?: { readonly givenName?: string; readonly familyName?: string; }; readonly signal: AbortSignal; }) => void | PromiseLike<void>;
postLogoutRedirects
readonly postLogoutRedirects?: readonly string[];
transactionTtlSeconds
readonly transactionTtlSeconds?: number;
fetch
readonly fetch?: typeof fetch;
clock
readonly clock?: () => number;

ProviderSessionRecordtype

ProviderSessionRecord: any
revision
readonly revision: number;
expiresAt
readonly expiresAt: number;
retired
readonly retired: boolean;
value
readonly value: string | null;

ProviderSessionStoretype

ProviderSessionStore: any
read
read(id: string, options: { signal: AbortSignal; }): Promise<ProviderSessionRecord | null>;
compareAndSwap
compareAndSwap(id: string, expectedRevision: number | null, next: ProviderSessionRecord, options: { signal: AbortSignal; }): Promise<boolean>;
withLock
withLock<T>(key: string, operation: () => Promise<T>, options: { signal: AbortSignal; }): Promise<T>;