Skip to content

SSOManager

@blobs/sdk v0.1.0


@blobs/sdk / sso / SSOManager

Defined in: sso/SSOManager.ts:44

Orchestrates the full SSO popup flow on the parent window side.

Opens an auth popup pointed at the network’s auth server, listens for postMessage frames keyed by SSOMessageType, and resolves a promise with an SSOResult on success or rejects with an SSOError on failure. Tracks lifecycle via SSOStatus and persists cross-tab state through SSOStorage.

Example

const sso = new SSOManager(ctx);
try {
const result = await sso.initiate({ network: 'public', returnUrl: '/' });
ctx.session.set(result);
} catch (err) {
console.error('SSO failed', err);
}

Constructors

Constructor

new SSOManager(ctx): SSOManager

Defined in: sso/SSOManager.ts:57

Parameters

ctx

BlobsContext

Shared SDK context — supplies network config and the session manager.

Returns

SSOManager

Methods

initiate()

initiate(config?): Promise<SSOResult>

Defined in: sso/SSOManager.ts:72

Starts an SSO flow, opening a popup and resolving with the result.

Merges config with DEFAULT_SSO_CONFIG, opens the auth popup, listens for postMessage frames, and rejects on timeout, user cancellation, or popup-blocker errors.

Parameters

config?

Partial<SSOConfig>

Optional partial config (network, scopes, callbacks, timeout, etc.).

Returns

Promise<SSOResult>

Resolves with an SSOResult on success.

Throws

With code SSO_IN_PROGRESS if a flow is already running, POPUP_FAILED if window.open returns null, TIMEOUT after the configured timeout, or CANCELLED if the user closes the popup.


cancel()

cancel(): void

Defined in: sso/SSOManager.ts:127

Cancels an in-flight SSO request.

Closes the popup, rejects the in-flight promise with code CANCELLED, and writes a cancelled history entry. No-op if no flow is active.

Returns

void


getStatus()

getStatus(): SSOStatus

Defined in: sso/SSOManager.ts:134

Returns the current SSOStatus.

Returns

SSOStatus


getAvailableSessions()

getAvailableSessions(): Promise<SSOCandidate[]>

Defined in: sso/SSOManager.ts:146

Refreshes the candidate list from the SDK’s session store and returns it.

Use this to populate “continue as …” UI before calling SSOManager.initiate with allowSessionSelection: true.

Returns

Promise<SSOCandidate[]>

Non-expired session candidates from local storage.


destroy()

destroy(): void

Defined in: sso/SSOManager.ts:500

Tears the manager down — cancels any in-flight flow and disposes the storage listener.

Call this when the surrounding SDK instance is being released.

Returns

void