Skip to content
Docs
Reference

Interface: SessionOptions

Interface: SessionOptions in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / SessionOptions

Defined in: auth/index.ts:300

Extends#

  • Omit<BackstageClientConfig, | "authMode" | "accessToken" | "refreshToken" | "onAuthFailure" | "onTokenRefresh" | "refreshEndpoint" | "dpop">

Properties#

baseUrl#

baseUrl: string;

Defined in: client.ts:857

Inherited from#

BackstageClientConfig.baseUrl


clientId?#

optional clientId: string;

Defined in: auth/index.ts:306


clientSecret?#

optional clientSecret: string;

Defined in: auth/index.ts:308

SERVER USE ONLY, as ClientCredentials.clientSecret.


credentials?#

optional credentials: RequestCredentials;

Defined in: client.ts:925

The fetch credentials mode. Cookie mode always sends 'include'; bearer mode sends the fetch default unless this says otherwise. The shell's sign-in page sets 'include' on its issuer client so the identity steps can leave the issuer's own login session.

Inherited from#

BackstageClientConfig.credentials


debug?#

optional debug: boolean | DebugConfig;

Defined in: client.ts:868

Enable debug mode for logging all SDK operations. Can be a boolean (enables all logging) or a DebugConfig object for fine-grained control.

Inherited from#

BackstageClientConfig.debug


dpop?#

optional dpop: DpopKey;

Defined in: auth/index.ts:314

The key the tokens are bound to. Pass it exactly when they were bound (exchange with dpop): every API call then goes as Authorization: DPoP with a proof, and every refresh with one.


headers?#

optional headers: Record<string, string>;

Defined in: client.ts:910

Inherited from#

BackstageClientConfig.headers


onSessionEnded()?#

optional onSessionEnded: (error: BackstageAPIError) => void | Promise<void>;

Defined in: auth/index.ts:323

Called once when the session ends: the issuer refused the refresh token (revoked, expired, reused; error.code is the OAuth error, e.g. invalid_grant), or signOut() ended it (error.code is SIGNED_OUT). Either way, show sign-in again.

Parameters#

ParameterType
errorBackstageAPIError

Returns#

void | Promise<void>


onTokens()?#

optional onTokens: (tokens: TokenSet) => void | Promise<void>;

Defined in: auth/index.ts:316

Called with every new token set (after a refresh or an organisation switch). Persist the refresh token here.

Parameters#

ParameterType
tokensTokenSet

Returns#

void | Promise<void>


organisationSlug?#

optional organisationSlug: string | () => string | undefined;

Defined in: client.ts:909

Resolves the organisation slug sent as the X-Ticketlayer-Org header in cookie mode. Pass a function so the org can change at runtime (e.g. an org switcher) without recreating the client. If omitted or it returns undefined, the SDK falls back to deriving the org from the subdomain.

Inherited from#

BackstageClientConfig.organisationSlug


refreshLeewaySeconds?#

optional refreshLeewaySeconds: number;

Defined in: auth/index.ts:325

Refresh ahead of expiry when a request finds this few seconds left. Default 30.


tokens#

tokens: StoredTokens;

Defined in: auth/index.ts:305