Framework-agnostic HTTP client for the Scenaro public API. No React or Transport dependencies.

createScenaroClient

ScenaroClientConfig

FieldTypeDefaultDescription
apiUrlstringrequiredAPI base URL (no trailing slash)
apiPathPrefixstring'/v1'Prepended to all endpoints
storagePrefixstring''Prefix for localStorage keys
storageStorageAdapter | nulllocalStorageCustom storage adapter

ScenaroClient methods

identifyUser

POST /public/token — returns JWT identity. Idempotent if valid token exists in storage.

startSession

POST /public/session — returns Transport credentials (LiveKit today: livekit_token, livekit_url — see Transport). Requires stored JWT. When language is omitted, the backend applies the language configured on the scenario.

getValidUserToken

Returns stored token if valid, otherwise silently re-identifies.

getStoredUserToken

Synchronous read from storage.

clearStoredSession

Clears identity blob and scenario pointer.

getSessionUserId / getSessionApplicationId

Read from stored identity blob.

JWT utilities

Storage exports

See Session storage for key format details.

Types

Re-exported from @scenaro/sdk/protocol:
  • IdentityResponse
  • PublicTokenRequest / PublicTokenResponse
  • PublicSessionRequest / PublicSessionResponse
  • SessionOptions