# @askrjs/auth/server

> Published API exports for @askrjs/auth/server.

Source: [https://askrjs.com/docs/reference/api/auth/server](https://askrjs.com/docs/reference/api/auth/server)

Status: stable. Packages: @askrjs/auth/server.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 11 exports from the declarations shipped by @askrjs/auth.

### `createOidcProvider`

```ts
createOidcProvider: (options: OidcProviderOptions) => ProviderDefinition
```

### `createProviderSession`

```ts
createProviderSession: (options: ProviderSessionOptions) => ProviderSession
```

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

### `InteractionRequiredError`

```ts
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[];

### `OidcProviderOptions`

```ts
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;
  };

### `ProviderDefinition`

```ts
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>>;

### `ProviderSession`

```ts
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`

```ts
ProviderSessionError: typeof ProviderSessionError
```

- `code`: readonly code: ProviderSessionErrorCode;

### `ProviderSessionErrorCode`

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

### `ProviderSessionOptions`

```ts
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;

### `ProviderSessionRecord`

```ts
ProviderSessionRecord: any
```

- `revision`: readonly revision: number;

- `expiresAt`: readonly expiresAt: number;

- `retired`: readonly retired: boolean;

- `value`: readonly value: string | null;

### `ProviderSessionStore`

```ts
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>;

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/auth/oidc/index.md) | [Next](https://askrjs.com/docs/reference/api/auth/providers--auth0/index.md)
