Skip to main content

Class: BaseApiClient

Defined in: packages/sdk/src/api/base.ts:157

Extended by

Constructors

Constructor

new BaseApiClient(apiKey, baseUrl, customFetch?): BaseApiClient

Defined in: packages/sdk/src/api/base.ts:177

Parameters

apiKey

string | undefined

baseUrl

string

customFetch?

{(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Returns

BaseApiClient

Methods

getActingMember()

getActingMember(): string | undefined

Defined in: packages/sdk/src/api/base.ts:230

Get the current acting member UUID.

Returns

string | undefined


setActingMember()

setActingMember(memberUuid): void

Defined in: packages/sdk/src/api/base.ts:223

Set the acting member UUID for member identity switching. When set, all API requests will include the X-Acting-Member header. The backend will validate that the authenticated account owns this member and use it as the effective identity for the request.

Parameters

memberUuid

string | undefined

Returns

void


setEnhancedAuthHandler()

setEnhancedAuthHandler(handler): void

Defined in: packages/sdk/src/api/base.ts:197

Set the handler for enhanced authentication requirements (RFC 9470 Step-Up Auth). This handler is called when a 401 response includes WWW-Authenticate header with error="insufficient_user_authentication".

Parameters

handler

EnhancedAuthHandler | undefined

Returns

void


setOrgAuthHandler()

setOrgAuthHandler(handler): void

Defined in: packages/sdk/src/api/base.ts:206

Set the handler for organization authentication requirements. This handler is called when a 401 response includes WWW-Authenticate header with realm="org". The handler should redirect the user to complete org auth.

Parameters

handler

OrgAuthHandler | undefined

Returns

void


setOrgSession()

setOrgSession(session, orgUuid?): void

Defined in: packages/sdk/src/api/base.ts:244

Set the opaque org session credential for cross-domain requests. Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still use X-Org-Token through setOrgToken() during the migration window.

orgUuid is the org that issued the credential; passing it lets the 401 handler detect a stale session when a subsequent request targets a different org and re-fire the org-auth handler instead of silently 401-ing. Callers without that context (legacy / unknown) may omit it.

Parameters

session

string | undefined

orgUuid?

string

Returns

void


setOrgToken()

setOrgToken(token, orgUuid?): void

Defined in: packages/sdk/src/api/base.ts:253

Parameters

token

string | undefined

orgUuid?

string

Returns

void

Deprecated

Legacy compatibility for stateless orgToken JWE credentials. Prefer setOrgSession() for opaque org browser sessions.


updateApiKey()

updateApiKey(newApiKey): void

Defined in: packages/sdk/src/api/base.ts:213

Update the API key (used after successful re-authentication).

Parameters

newApiKey

string

Returns

void