Skip to main content

Interface: LaunchpadSession

Gala Launchpad SDK 9.0.0-rc.5


Gala Launchpad SDK 9.0.0-rc.5 / index / LaunchpadSession

Interface: LaunchpadSession

Defined in: packages/launchpad-sdk/dist/auth/session.d.ts:29

The app's session, as the SDK sees it.

Example​

const sdk = createLaunchpadSDK({
env: 'stage',
session: {
accessToken: () => authMachine.currentToken(), // may wait for boot, refresh one about to expire
onUnauthorized: (rejected) => authMachine.recover(rejected), // fresh token to retry with, or null
},
});

Properties​

credentials?​

readonly optional credentials?: "include" | "omit"

Defined in: packages/launchpad-sdk/dist/auth/session.d.ts:46

Whether launchpad-backend requests carry the browser's cookies. Default 'include': the refresh cookie is only stored and presented on credentialed requests. 'omit' for a session that does not use the cookie.

Methods​

accessToken()​

accessToken(): Promise<string | null>

Defined in: packages/launchpad-sdk/dist/auth/session.d.ts:34

The bearer for the next launchpad-backend request, or null to send it unauthenticated. Awaited before every request, so it may wait (for the app's boot) or refresh first.

Returns​

Promise<string | null>


onUnauthorized()​

onUnauthorized(rejectedToken): Promise<string | null>

Defined in: packages/launchpad-sdk/dist/auth/session.d.ts:40

A launchpad-backend request answered 401. rejectedToken is the bearer it carried (null: it carried none). Resolve to a fresh token to retry the request once with it, or null to fail the request with that 401. Called once per request at most.

Parameters​

rejectedToken​

string | null

Returns​

Promise<string | null>