BackstageClientConfig
@ticketlayer/backstage / BackstageClientConfig
Interface: BackstageClientConfig
Defined in: client.ts:326
Properties
accessToken?
optional accessToken: string | () => string | undefined;
Defined in: client.ts:344
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:333
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:327
debug?
optional debug: boolean | DebugConfig;
Defined in: client.ts:338
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:371
onAuthFailure()?
optional onAuthFailure: () => Promise<boolean>;
Defined in: client.ts:357
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:350
Called after successful token refresh (bearer mode only). Use this to persist the new tokens.
Parameters
| Parameter | Type |
|---|---|
accessToken | string |
refreshToken | string |
Returns
void | Promise<void>
organisationSlug?
optional organisationSlug: string | () => string | undefined;
Defined in: client.ts:370
Resolves the organisation slug sent as the X-Ticketlayer-Org header. Pass a function so the org can change at runtime (e.g. an org switcher) without recreating the client. In cookie mode, if omitted or it returns undefined, the SDK falls back to deriving the org from the subdomain. In bearer mode the header is only sent when this is configured (embed sessions need it).
refreshEndpoint?
optional refreshEndpoint: string;
Defined in: client.ts:362
Custom refresh endpoint. Default: '/api/oauth/refresh' for cookie mode, '/v1/auth/refresh' for bearer mode
refreshToken?
optional refreshToken: string;
Defined in: client.ts:345