Skip to main content

BackstageClientConfig

@ticketlayer/backstage


@ticketlayer/backstage / BackstageClientConfig

Interface: BackstageClientConfig

Defined in: client.ts:313

Properties​

accessToken?​

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

Defined in: client.ts:331

Bearer token (bearer mode). A resolver function is read on every request, so a host that rotates tokens (an embed session refreshed by its parent window) never has to recreate the client.


authMode?​

optional authMode: AuthMode;

Defined in: client.ts:320

Authentication mode:

  • 'bearer': Use Authorization header with access/refresh tokens (default)
  • 'cookie': Use HTTP-only cookies (for Next.js apps with OAuth)

baseUrl​

baseUrl: string;

Defined in: client.ts:314


debug?​

optional debug: boolean | DebugConfig;

Defined in: client.ts:325

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


headers?​

optional headers: Record<string, string>;

Defined in: client.ts:357


onAuthFailure()?​

optional onAuthFailure: () => Promise<boolean>;

Defined in: client.ts:344

Called when a 401 is received. Return true if refresh was successful and the request should be retried. If not provided, default behaviour depends on authMode:

  • cookie mode: calls refreshEndpoint automatically
  • bearer mode: uses refreshToken if available

Returns​

Promise<boolean>


onTokenRefresh()?​

optional onTokenRefresh: (accessToken: string, refreshToken: string) => void | Promise<void>;

Defined in: client.ts:337

Called after successful token refresh (bearer mode only). Use this to persist the new tokens.

Parameters​

ParameterType
accessTokenstring
refreshTokenstring

Returns​

void | Promise<void>


organisationSlug?​

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

Defined in: client.ts:356

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.


refreshEndpoint?​

optional refreshEndpoint: string;

Defined in: client.ts:349

Custom refresh endpoint. Default: '/api/oauth/refresh' for cookie mode, '/v1/auth/refresh' for bearer mode


refreshToken?​

optional refreshToken: string;

Defined in: client.ts:332