oc · docs
docs / documentation

@orangecheck/auth-client


@orangecheck/auth-client / consumeTabAccountHint

Function: consumeTabAccountHint()

function consumeTabAccountHint(authOrigin: string): Promise<string | null>;

Defined in: tab-session.ts:300

On load, if the URL carries #oc-as=<did>, adopt that account for THIS tab: mint a pin for it via the host's /api/auth/tab (which re-validates the did is in this browser's roster) and stash it in sessionStorage, then strip the fragment from the address bar. Must run BEFORE the provider's first /api/auth/me fetch so that fetch carries the right pin.

Returns the adopted did:oc on success, else null. Best-effort and fail-safe: a stale host (no targeted minting), a roster miss (403), or a network error leaves the tab unpinned — exactly the legacy cookie-following behavior. The fragment is always stripped so it never lingers in history/bookmarks or re-fires on reload.

Parameters

ParameterType
authOriginstring

Returns

Promise&lt;string | null>