Skip to content

The client package

For: a developer who calls authtempo from a browser app, a native app, a desktop app, or a CLI.

What it does: this page lists the options of createClient, each operation with its route, the result type, and every export of the package. The export check holds this page to packages/client/src/index.ts.

createClient(options) answers a Client. The type of the options is ClientOptions.

Option Default What it does
baseURL required The origin of the API. One trailing / is removed.
basePath "/auth" The mount path of the routes.
credentials "include" A native app, a desktop app, and a CLI pass "omit". Core reads the cookie before the bearer header.
token none A function that answers the bearer token, or null.
fetch globalThis.fetch The fetch of every call.
webauthn browserWebAuthn() The passkey seam, of the type BrowserWebAuthn.
navigate location.assign Sends the browser to the social start URL. A router or a test injects one. With the default and no location, as in a server render, social.signIn answers unexpected.
broadcast true where BroadcastChannel exists Tell the other tabs of the origin after a change, on the channel authtempo-session, and read again when one tells.
refetchOnVisible true where document exists Read the session again when the page becomes visible.
onSessionEnd none Runs with sent, the token that the read sent, when session() answers null to a 401. It does not run when no token was sent. Clear the stored token only when it is still sent: a newer sign-in may have written another.
cookies document.cookie A function that answers the cookies that page script can read. lastMethod() reads it. Where no document exists, the default answers none.
lastMethodCookie "__Host-tempo_last_method" The name of the last method cookie. Set it to the server’s lastMethod.cookieName when you change that.

createTransport(options) answers a Call for a route of your own app’s code. Its path is a RoutePath of @authtempo/core/routes, so a path that core does not serve fails the compile. A query goes in the fourth argument, never in the path. More request headers go in the fifth argument.

Every operation answers a ClientResult. A success is { ok: true, value }. A failure is a ClientFailure: { ok: false, code, status }.

  • An operation never throws for an answer. Check ok, then read code.
  • status is the HTTP status, or 0 when no answer arrived.
  • code is a ClientCode: an ErrorCode of core, or one of the three codes below.
Code When it appears
network The fetch rejected. The device is offline, the host is not reachable, or the browser blocked the answer.
unexpected The answer is not JSON, or its error code is not in the core table. A session read, a handoff redeem, or an account settings operation that answers 200 with a body of another shape gives unexpected with status 200.
cancelled The person dismissed the passkey prompt, or no authenticator matched.

client.errors and the export ERRORS are the error table of core.

client.store holds the session for a page. Its state, a ClientSessionState, is { data, error, isPending, isRefetching }: data is the PublicSession or null, and error is a ClientFailure or null.

  • store.subscribe(listener) adds a listener. The first one starts the first read. It answers the function that removes the listener.
  • store.get() answers the state. The object stays the same until the next change.
  • store.refetch() reads the session again.
  • The store reads again after each sign-in and after the sign-out.
  • It reads again after the second factor verify and enable, a password reset or change, and the address verify.
  • It reads again after the active organization changes, after an organization delete or a member remove, and after the handoff redeem.
  • It reads again after the revoke of a session, a profile update, an address change confirm, and the account delete.
  • It reads again when another tab of the origin changes the session, and when the page becomes visible. It does not poll.

createSessionStore makes the same store over a read of your own.

Operation Route Value
client.session() GET /session PublicSession or null. A 401 gives null, not a failure. With core’s session.deferRefresh on, the session holds needsRefresh. session.actorId is the operator’s user id in an impersonation session, else null
client.session.refresh() POST /session/refresh As session(). It slides the expiry and renews the cookie when the refresh is due. The store reads again. The store’s own read calls it when needsRefresh is true, and keeps the GET answer if it fails. Call it yourself after a direct session().
client.signOut() POST /sign-out { ok: true }
client.readRedirectError(url) none The code of ?auth_error=<code>: an ErrorCode or an OAuthErrorCode, because core’s OAuth sign-in route sends a code of OAUTH_ERRORS. unexpected for a code that neither table has, or null
client.social.startURL({ provider, next?, data? }) GET /social/:provider/start (built, not fetched) string; invalid_body with status 0 for a name that core refuses. data is a JSON object that the hooks of the sign-in get. The client sends it as base64url in the query, so it is never a secret. It needs the server’s social.stateData
client.social.signIn({ provider, next?, data? }) GET /social/:provider/start (a navigation) { url }; unexpected with status 0 when the default navigate finds no location
client.social.idTokenNonce({ provider }) POST /social/:provider/id-token/nonce { nonce, providerNonce, expiresAt }. Give providerNonce to Google or Apple. Keep nonce for idToken
client.social.oneTapNonce() POST /social/google/id-token/nonce As idTokenNonce({ provider: "google" }), for Google One Tap
client.social.idToken({ provider, idToken, nonce?, name?, next?, trustDevice? }) POST /social/:provider/id-token { token } and PublicSession, or a TwoFactorChallengeJSON. The token and the nonce go in the body, never in a URL. name is the name that Apple’s sheet gives
client.signIn.password({ email | username | phone, password, trustDevice?, next?, captchaToken? }) POST /password/sign-in, then POST /totp/verify through verify PasswordSignIn: { kind: "session", session }, or { kind: "second-factor", challenge, expiresAt, methods, verify }. verify takes { code }, { backupCode }, or { emailCode }. For the passkey method, call secondFactor.passkey.verify
client.magicLink.request({ email, next? }) POST /magic-link/request { sent: true }
client.magicLink.verify({ token, trustDevice? }) POST /magic-link/verify PublicSession, or a TwoFactorChallengeJSON
client.passkey.register({ name?, hints? }) POST /passkey/register/options, then /passkey/register/verify PasskeySummaryJSON. hints replace the server’s list for this ceremony: security-key, client-device, or hybrid
client.passkey.signUp({ name, hints?, captchaToken? }) POST /passkey/sign-up/options, then /passkey/sign-up/verify PublicSession of a new account whose only way in is the new passkey. It needs the server’s passkey.signUp
client.passkey.signIn({ autofill?, hints?, extensions?, onExtensionResults? }) POST /passkey/authenticate/options, then /passkey/authenticate/verify PublicSession. With autofill: true the browser waits for the autofill of a field with autocomplete="username webauthn"; with no conditional mediation it answers cancelled and sends nothing. extensions takes PRF salts and a largeBlob read. After a sign-in that succeeded, onExtensionResults gets the PRF output and the large blob; the client never sends them
client.passkey.signalUnknown({ rpId, credentialId }) none true when the browser has PublicKeyCredential.signalUnknownCredential, else false. It never throws. passkey.signIn calls it once on passkey_unknown
client.passkey.abort() none Ends a waiting passkey ceremony, which answers cancelled. A new passkey ceremony also ends the waiting one, because a browser refuses a second pending request
client.passkeys.list() GET /passkeys PasskeySummaryJSON[]
client.passkeys.delete({ id }) POST /passkeys/delete { ok: true }
client.passkeys.rename({ id, name }) POST /passkeys/rename PasskeySummaryJSON. No fresh session is needed
client.passkeys.sync() GET /passkeys { signaled }. It gives the browser the credential ids that the server holds, through PublicKeyCredential.signalAllAcceptedCredentials
client.passkeys.signalDetails() GET /passkeys { signaled }. It gives the browser the current names of the person, through PublicKeyCredential.signalCurrentUserDetails
client.handoff.redeem({ code, verifier }) POST /handoff/redeem { token } and PublicSession
client.password.signUp({ email, password, name?, username? }) POST /password/sign-up { sent: true } by default; with the server’s password.uniformSignUp: false, { token } and PublicSession. Each answer holds signUpProof. A browser also gets it as a cookie. A native app keeps it for verifyCode, resendVerification, and signIn
client.password.signIn({ email | username | phone, password, trustDevice?, next?, captchaToken?, signUpProof? }) POST /password/sign-in { token } and PublicSession, or a TwoFactorChallengeJSON. A native app passes signUpProof, so the new link or code of an unverified user keeps the password
client.password.resendVerification({ email, signUpProof? }) POST /password/verify/resend { sent: true }
client.password.verifyEmail({ token }) POST /password/verify { verified: true, passwordKept }. passwordKept is false when the browser held no sign-up proof: the password went, and the app asks for a first password. The answer holds no token, so a native app keeps no session: it confirms by verifyCode with signUpProof
client.password.verifyCode({ email, code, signUpProof? }) POST /password/verify/code A session with token, or { verified: true }, each with passwordKept
client.password.requestReset({ email, next? }) POST /password/reset/request { sent: true }
client.password.reset({ token, password, trustDevice? }) POST /password/reset { token } and PublicSession, or a TwoFactorChallengeJSON
client.password.change({ currentPassword?, newPassword }) POST /password/change { ok: true }
client.emailOtp.request({ email }) POST /otp/request { sent: true }
client.emailOtp.verify({ email, code, trustDevice? }) POST /otp/verify { token } and PublicSession, or a TwoFactorChallengeJSON
client.emailOtp.requestReset({ email }) POST /otp/reset/request { sent: true }
client.emailOtp.reset({ email, code, password, trustDevice? }) POST /otp/reset { token } and PublicSession, or a TwoFactorChallengeJSON
client.phone.request({ phone, captchaToken? }) POST /phone/request { sent: true } for a known and an unknown number
client.phone.verify({ phone, code, trustDevice? }) POST /phone/verify { token } and PublicSession, or a TwoFactorChallengeJSON
client.phone.add({ phone }) POST /phone/add { sent: true }. It needs a fresh session
client.phone.verifyAdd({ code }) POST /phone/add/verify { phone }. It needs a fresh session
client.phone.remove() POST /phone/remove { ok: true }. It needs a fresh session
client.anonymous.signIn({ captchaToken? }) POST /anonymous/sign-in { token } and PublicSession of a new anonymous user, or of the live anonymous session
client.anonymous.delete() POST /anonymous/delete { ok: true }. Only an anonymous session may call it
client.multiSession.list() GET /multi-session BrowserSessionJSON[]: the sessions of this browser, with no token
client.multiSession.switch({ sessionId }) POST /multi-session/switch PublicSession of the session that is now active
client.multiSession.signOut({ sessionId }) POST /multi-session/sign-out { ok: true }. It ends one session of this browser; signOut() ends each one
client.lastMethod() none The LastMethod of the last sign-in in this browser, from the last method cookie, or null. A value outside core’s closed set reads as null. It names a method, never an account
client.totp.setup({ password }) or client.totp.setup({ emailCode }) POST /totp/setup { secret, uri, backupCodes }
client.totp.enable({ code }) POST /totp/enable TotpStatusJSON
client.totp.verify({ challenge, code?, backupCode?, emailCode?, trustDevice? }) POST /totp/verify TwoFactorSessionJSON
client.totp.disable({ code }) POST /totp/disable { ok: true }
client.totp.regenerateBackupCodes({ code }) POST /totp/backup-codes { backupCodes }
client.totp.status() GET /totp TotpStatusJSON
client.totp.revokeTrustedDevices() POST /totp/devices/revoke { ok: true }
client.secondFactor.passkey.enable({ password }) POST /passkey/authenticate/options, then POST /second-factor/passkey/enable SecondFactorEnableJSON
client.secondFactor.passkey.verify({ challenge, trustDevice? }) POST /second-factor/passkey/options, then POST /totp/verify TwoFactorSessionJSON
client.secondFactor.email.enable({ password }) POST /second-factor/email/enable SecondFactorEnableJSON
client.secondFactor.email.send({ challenge }) POST /second-factor/email/send { sent: true }
client.secondFactor.disable({ method, password }) POST /second-factor/disable { ok: true, methods }
client.organizations.create({ slug, name, metadata? }) POST /organizations/create { organization: OrganizationJSON, member: MemberJSON }
client.organizations.list() GET /organizations { organization, role }[]
client.organizations.update({ organizationId, name?, slug?, metadata? }) POST /organizations/update OrganizationJSON
client.organizations.delete({ organizationId }) POST /organizations/delete { ok: true }
client.organizations.members.list({ organizationId }) GET /organizations/members MemberJSON[]
client.organizations.members.add({ organizationId, userId, role }) POST /organizations/members/add MemberJSON
client.organizations.members.role({ organizationId, userId, role }) POST /organizations/members/role MemberJSON
client.organizations.members.remove({ organizationId, userId, revokeTokens? }) POST /organizations/members/remove { ok: true }. revokeTokens: true deletes the person’s organization tokens too
client.organizations.invitations.invite({ organizationId, email, role }) POST /organizations/invite InvitationJSON
client.organizations.invitations.list({ organizationId }) GET /organizations/invitations InvitationJSON[]
client.organizations.invitations.revoke({ organizationId, invitationId }) POST /organizations/invitations/revoke { ok: true }
client.organizations.invitations.accept({ token }) POST /organizations/invitations/accept { organization, member }
client.organizations.invitations.decline({ token }) POST /organizations/invitations/decline { ok: true }
client.organizations.setActive({ organizationId }) POST /organizations/active PublicSession
client.organizations.hasPermission({ organizationId, permissions }) POST /organizations/has-permission boolean. It only hides a control: the server check decides
client.organizations.permissions({ organizationId }) GET /organizations/permissions { role, permissions }. A non-member gets role: null and {}
client.organizations.checkSlug({ slug }) POST /organizations/check-slug { slug, status }. available is a hint, not a hold
client.organizations.roles.list({ organizationId }) GET /organizations/roles RoleJSON[]
client.organizations.roles.get({ organizationId, name }) GET /organizations/roles/get RoleJSON
client.organizations.roles.create({ organizationId, name, rank?, permissions }) POST /organizations/roles/create RoleJSON
client.organizations.roles.update({ organizationId, name, rank?, permissions? }) POST /organizations/roles/update RoleJSON
client.organizations.roles.delete({ organizationId, name }) POST /organizations/roles/delete { ok: true }
client.organizations.teams.list({ organizationId }) GET /organizations/teams TeamJSON[]
client.organizations.teams.create({ organizationId, name }) POST /organizations/teams/create TeamJSON
client.organizations.teams.update({ teamId, name }) POST /organizations/teams/update TeamJSON
client.organizations.teams.delete({ teamId }) POST /organizations/teams/delete { ok: true }
client.organizations.teams.members.list({ teamId }) GET /organizations/teams/members TeamMemberJSON[]
client.organizations.teams.members.add({ teamId, userId }) POST /organizations/teams/members/add TeamMemberJSON
client.organizations.teams.members.remove({ teamId, userId }) POST /organizations/teams/members/remove { ok: true }. A member leaves a team with their own userId
client.organizations.teams.setActive({ teamId }) POST /organizations/teams/active PublicSession, with session.activeTeamId
client.organizations.teams.mine() GET /organizations/teams/mine TeamJSON[], the teams of the user in every organization
client.organizations.tokens.create({ organizationId, name, permissions, expiresInDays?, metadata? }) POST /organizations/tokens { token, apiToken: OrganizationTokenSummaryJSON }
client.organizations.tokens.list({ organizationId }) GET /organizations/tokens OrganizationTokenSummaryJSON[]
client.organizations.tokens.update({ organizationId, id, name?, permissions?, expiresAt? }) POST /organizations/tokens/update OrganizationTokenSummaryJSON, after a narrow-only change
client.organizations.tokens.revoke({ organizationId, id }) POST /organizations/tokens/revoke { ok: true }
client.organizations.tokens.current() GET /organizations/tokens/current { organization, apiToken }, with a to_ token
client.organizations.audit.list(query: OrganizationAuditQuery) GET /organizations/audit { rows: OrganizationAuditView[], next }. Pass next as after for the next page. next is null on the last page. It needs audit:read
client.organizations.audit.export(query) GET /organizations/audit An AsyncIterable<OrganizationAuditView> of every row of the query. It reads pages of 100, one page at a time, and only when the caller asks for the next row. A failed page throws its ClientFailure after the rows of the pages before it
client.tokens.create({ name, expiresInDays?, organizationId?, permissions?, metadata? }) POST /tokens { token, apiToken: ApiTokenSummaryJSON }
client.tokens.list() GET /tokens ApiTokenSummaryJSON[]
client.tokens.revoke({ id }) POST /tokens/revoke { ok: true }
client.tokens.update({ id, name?, permissions?, expiresAt? }) POST /tokens/update ApiTokenSummaryJSON, after a narrow-only change
client.tokens.current() GET /tokens/current { user, apiToken }
client.jwt.token() GET /token { token }
client.oauth.grants() GET /oauth/grants OAuthGrantJSON[]
client.oauth.revoke({ clientId }) POST /oauth/grants/revoke { ok: true }
client.sso.discover({ email, next? }) POST /sso/discover { sso: true, connectionId, start } or { sso: false }. start is an absolute URL on the origin of baseURL, with next as its query. It takes no session
client.sso.startURL({ connectionId, next? }) GET /sso/:connectionId/start The URL of the start, with no request. invalid_body with status 0 for an id outside the segment rule
client.sso.signIn({ connectionId, next? }) GET /sso/:connectionId/start { url }, after it sends the browser to the start through navigate
client.sso.domains.list({ organizationId }) GET /sso/domains SsoDomainJSON[]
client.sso.domains.add({ organizationId, domain }) POST /sso/domains/add SsoDomainJSON, with record, the TXT record to publish
client.sso.domains.verify({ id }) POST /sso/domains/verify SsoDomainJSON with verified: true
client.sso.domains.update({ id, connectionId?, enforce?, includeSubdomains? }) POST /sso/domains/update SsoDomainJSON
client.sso.domains.delete({ id }) POST /sso/domains/delete { ok: true }
client.sso.connections.list({ organizationId }) GET /sso/connections SsoConnectionListedJSON[]: each SsoConnectionJSON with its status. No answer holds the client secret
client.sso.connections.create(input: SsoConnectionInput) POST /sso/connections/create SsoConnectionJSON
client.sso.connections.update({ id, ...fields }) POST /sso/connections/update SsoConnectionJSON
client.sso.connections.delete({ id }) POST /sso/connections/delete { ok: true }
client.scim.tokens.list({ organizationId }) GET /scim/tokens ScimTokenJSON[]
client.scim.tokens.create({ organizationId, name, scopes?, expiresInDays? }) POST /scim/tokens/create { token, id, hint }. The clear token appears once
client.scim.tokens.revoke({ id }) POST /scim/tokens/revoke { ok: true }
client.sso.setupLinks.create({ organizationId, steps, kinds, note, ttlHours? }) POST /sso/setup-links/create { id, token, expiresAt }. The clear token appears once
client.sso.setupLinks.list({ organizationId }) GET /sso/setup-links/list SetupLinkJSON[]
client.sso.setupLinks.get({ id }) GET /sso/setup-links/get { link, preview }. preview is null while the link has no draft
client.sso.setupLinks.revoke({ id }) POST /sso/setup-links/revoke { ok: true }
client.sso.setupLinks.activate({ id, version }) POST /sso/setup-links/activate SsoConnectionJSON. version is preview.version of the read. conflict when the draft changed after the read. setup_not_tested until a test of the current draft passes
client.sso.setup.open({ token }) POST /sso/setup/open { linkId }, and the setup cookie
client.sso.setup.status({ run? }) GET /sso/setup/status SetupStatusJSON: the link, the drafts of the session, and the test result
client.sso.setup.domains.add({ domain }) POST /sso/setup/domains/add SsoDomainJSON, with record
client.sso.setup.domains.verify({ id }) POST /sso/setup/domains/verify SsoDomainJSON
client.sso.setup.connection(input: SetupConnectionInput) POST /sso/setup/connection SsoConnectionJSON, a draft. No answer holds the client secret
client.sso.setup.scimToken() POST /sso/setup/scim-token { id, token, scimBaseUrl }. The clear token appears once
client.sso.setup.handback() POST /sso/setup/handback { ok: true }

The password, email code, and second factor operations answer not_found when the server turns the feature off.

The SSO and SCIM token operations answer not_found when the server turns sso or scim off. A domain, connection, or SCIM token call needs a fresh session of an owner with a second factor on. Wrap each one in withFresh. Enterprise SSO and SCIM provisioning give the flows.

The sso.setupLinks calls need a signed-in manager of the organization and sso.setup on the server. A link of another organization answers forbidden_rank. The sso.setup calls need the setup cookie that sso.setup.open sets. A bearer token or a normal session cookie answers unauthorized there, so make the client of the setup page with no token. The setup session calls are for a browser: the cookie is __Host- and HttpOnly.

sso.connections.create sends organizationId in the query, and sso.connections.update sends id in the query. The body holds the other fields. Core runs the manager guard before it reads the body.

For passkey autofill, start the autofill when the page loads, before a passkey button can run. A new passkey ceremony ends a waiting one, also a register.

These operations serve the settings page of the signed-in person. Each one needs a session, except user.confirmEmailChange.

Operation Route Value
client.sessions.list() GET /sessions SessionSummaryJSON[], newest first. current marks the caller’s session. impersonation marks a session that a platform operator opened, and names no operator
client.sessions.revoke({ id }) POST /sessions/revoke { ok: true, current }. See the rule below the table
client.sessions.revokeOthers() POST /sessions/revoke-others { ended }, the count of ended sessions
client.sessions.revokeAll() POST /sessions/revoke-all { ended }, the count of ended sessions, with the caller’s own. The caller is then signed out
client.reauth.password({ password, code? }) POST /reauth FreshJSON. code is the second factor, while it is on
client.reauth.requestEmailCode() POST /reauth/email { sent: true }. The code goes to the account’s address
client.reauth.emailCode({ emailCode, code? }) POST /reauth FreshJSON
client.reauth.passkey() POST /reauth/passkey/options, then POST /reauth FreshJSON. A dismissed prompt answers cancelled
client.user.update({ name?, image? }) POST /user/update { user: PublicUserJSON }. null clears a field
client.user.changeEmail({ newEmail, method?, next? }) POST /user/change-email { sent: true }. method is link (default) or code
client.user.confirmEmailChange({ token }) POST /user/change-email/confirm { user: PublicUserJSON }, for an app that serves its own confirm page
client.user.verifyEmailChange({ code }) POST /user/change-email/verify { user: PublicUserJSON }
client.user.delete() POST /user/delete { ok: true }: the account and the caller’s session end. { sent: true }: the server’s account.deleteConfirm is on, a link went to the address, and nothing is deleted yet
client.user.confirmDelete({ token }) POST /user/delete/confirm { ok: true }, for an app that serves its own confirm page of the mailed delete link. It needs a session of the same user, not a fresh one
client.username.available({ username }) GET /username/available { available }. It needs no session
client.username.set({ username }) POST /user/username { username, displayUsername }. It needs a fresh session
client.identities.list() GET /identities IdentityListJSON: identities, password, passkeys
client.identities.unlink({ id }) POST /identities/unlink { ok: true }
client.identities.link({ provider, next?, data? }) POST /social/:provider/link, then a navigation { url }; invalid_body with status 0 for a name that core refuses

GET /user/change-email/confirm is the page of the mailed link. A browser opens it, so the client has no call for it.

The revoke of the caller’s own session. The answer’s current is true when id is the id of the caller’s own session. Then that session has ended. A browser loses the cookie, and a bearer app must clear its stored token.

A fresh session. Some changes need a fresh session: a sign-in or a re-authentication that is younger than session.freshMinutes. A stale session gets session_not_fresh (403), and nothing changes. These calls can answer it:

  • sessions.revoke, sessions.revokeOthers, sessions.revokeAll
  • user.changeEmail, user.delete
  • identities.unlink, identities.link
  • passkey.register, passkeys.delete
  • tokens.create, tokens.update
  • organizations.roles.create, organizations.roles.update, organizations.roles.delete
  • organizations.tokens.create, organizations.tokens.update
  • organizations.members.remove with revokeTokens: true
  • totp.enable, totp.disable, totp.regenerateBackupCodes
  • secondFactor.passkey.enable, secondFactor.email.enable, secondFactor.disable
  • password.change while the second factor is on, and for a first password

withFresh(op, reauth) gives the path. It runs op, the change. On session_not_fresh, it runs reauth, the re-authentication of your page, then op once more. An example is client.withFresh(() => client.user.delete(), () => client.reauth.password({ password })).

A failed re-authentication is the answer, and the change does not run again. A second session_not_fresh is the answer too, so withFresh never loops. A re-authentication keeps the session token. Core checks the rule of secondFactor.passkey.enable after its passkey prompt. So under withFresh, that call can show the prompt two times.

The link of a provider. identities.link posts the start. Then it sends the browser to the provider through navigate. The client navigates only to an http: or an https: URL. The provider sends the browser back to next. A failure lands on ?auth_error=<code>, for example identity_taken, email_mismatch, or email_required. Read the code with readRedirectError.

Error codes. Routes gives every error of each route. The codes of these operations include session_not_fresh, last_credential, identity_taken, sole_owner, email_taken, and conflict. Error codes explains each one, and errorText has a sentence for each.

errorText(code) answers one sentence for a code, for an app to show to a person. errorDocsURL(code) answers the docs page of the code: its anchor on Error codes, or the Results section for network, unexpected, and cancelled. redirect_mismatch links to the failure codes of the handoff. Pass "oauth" as the second argument for a code of the OAuth client, because invalid_token and rate_limited are in both tables. ERROR_TEXT holds every text, by table.

errorText(code, locale) answers the text in a language of LOCALES. English ("en") is the default and the only language of the list. For a code of the OAuth client, the locale is the third argument: errorText(code, "oauth", locale). resolveLocale(navigator.language) picks the locale of a language tag, else English. The docs link of a code is the same in every language.

Export What it is
createClient Makes a Client.
createTransport The typed call for a route of your own app’s code, with its TransportOptions and the Call type. The client uses the same request code, and takes its paths from CLIENT_CALLS.
browserWebAuthn The passkey seam of a browser, on navigator.credentials.
supportsPasskeys True when the browser can run the passkey ceremonies.
supportsAutofill True when the browser has conditional mediation for passkeys.
readRedirectError The redirect error reader of client.readRedirectError.
credentialToJSON Converts a credential of the browser to the JSON that core reads.
toBinaryCreationOptions, toBinaryRequestOptions Convert the options JSON of core for a browser with no parseCreationOptionsFromJSON.
splitExtensionResults Takes prf.results and largeBlob.blob out of a ceremony response, as PasskeyExtensionResults. The passkey calls of the client use it.
base64UrlEncode, base64UrlDecode The base64url codec of the conversions.
WebAuthnCancelled The error that the seam throws for a dismissed prompt. The client answers cancelled for it.
ERRORS The error table of core.
CLIENT_CALLS The table of every route that the client calls, with each operation, method, and path. The client takes each path from it.
createSessionStore Makes a session store over a read function.
SESSION_CHANNEL The name of the BroadcastChannel, authtempo-session.
errorText One sentence for a code.
errorDocsURL The docs link of a code.
ERROR_TEXTS Every error text, by language and table.
LOCALES The languages of the error texts: ["en"].
resolveLocale The locale of a language tag, else English.
errorAnchor The anchor of a code on the errors page.
ERROR_TEXT Every error text, by table.
DOCS_ORIGIN The origin of the docs, https://authtempo.com.
roleHasPermission True when a role string holds every wanted action in a static role table. It comes from @authtempo/core/access. A client check only hides a control: the server check decides.

The types of the package:

Area Types
The client Client, ClientOptions, ClientResult, ClientFailure, ClientCode, OAuthClientCode, OAuthFailure, OAuthResult, SdkCode, ErrorTable, ErrorCode, Call, Query, TransportOptions, ClientCall, ClientOperation, Statements, ClientSessionState, SessionState, SessionStore, Locale, ErrorTexts
Passkeys BrowserWebAuthn, CredentialsContainerLike, PublicKeyCredentialLike, PasskeySummaryJSON, CeremonyOptions, PasskeyExtensionResults
Sign-in additions PasswordIdentifier, IdTokenNonceJSON, BrowserSessionJSON, SocialStateData
Answers ApiTokenSummaryJSON, OrganizationTokenSummaryJSON, InvitationJSON, MemberJSON, RoleJSON, TeamJSON, TeamMemberJSON, OrganizationAuditView, OrganizationAuditQuery, OAuthGrantJSON, OrganizationJSON, TotpStatusJSON, ChallengeMethodJSON, SecondFactorEnableJSON, TwoFactorChallengeJSON, TwoFactorSessionJSON, PasswordSignIn
Account settings SessionSummaryJSON, FreshJSON, PublicUserJSON, IdentityEntryJSON, IdentityListJSON
Enterprise SSO and SCIM SsoDomainJSON, SsoConnectionJSON, SsoConnectionListedJSON, SsoConnectionInput, ScimTokenJSON, SetupLinkJSON, SetupLinkInput, SetupPreviewJSON, SetupConnectionInput, SetupStatusJSON