Auth
This is the main module to interact with Nhost’s Auth service. Typically you would use this module via the main Nhost client but you can also use it directly if you have a specific use case.
Import
Section titled “Import”You can import and use this package with:
import { createAPIClient } from "@nhost/nhost-js/auth";import { createClient } from "@nhost/nhost-js";
const nhost = createClient({ subdomain, region,});
await nhost.auth.signUpEmailPassword({ email, password,});Error handling
Section titled “Error handling”The SDK will throw errors in most operations if the request returns a status >=300 or
if the request fails entirely (i.e., due to network errors). The type of the error
will be a FetchError<ErrorResponse>:
import { createClient } from "@nhost/nhost-js";import { FetchError } from "@nhost/nhost-js/fetch";
const nhost = createClient({ subdomain, region,});
try { await nhost.auth.signInEmailPassword({ email, password, });} catch (err) { if (!(err instanceof FetchError)) { throw err; // Re-throw if it's not a FetchError }
console.log("Error:", err); // Error: { // body: { // error: 'invalid-email-password', // message: 'Incorrect email or password', // status: 401 // }, // status: 401, // headers: { // 'content-length': '88', // 'content-type': 'application/json', // date: 'Mon, 12 May 2025 08:08:28 GMT' // } // }
// error handling...}This type extends the standard Error type so if you want to just log the error you can
do so like this:
import { createClient } from "@nhost/nhost-js";import { FetchError } from "@nhost/nhost-js/fetch";
const nhost = createClient({ subdomain, region,});
try { await nhost.auth.signInEmailPassword({ email, password, });} catch (err) { if (!(err instanceof Error)) { throw err; // Re-throw if it's not an Error }
console.log("Error:", err.message); // Error: Incorrect email or password}Interfaces
Section titled “Interfaces”AuthenticationExtensionsClientOutputs
Section titled “AuthenticationExtensionsClientOutputs”Map of extension outputs from the client
Properties
Section titled “Properties”appid?
Section titled “appid?”appid?: boolean;Application identifier extension output
credProps?
Section titled “credProps?”credProps?: CredentialPropertiesOutput;Credential properties extension output
hmacCreateSecret?
Section titled “hmacCreateSecret?”hmacCreateSecret?: boolean;HMAC secret extension output
AuthenticatorAssertionResponse
Section titled “AuthenticatorAssertionResponse”Properties
Section titled “Properties”authenticatorData
Section titled “authenticatorData”authenticatorData: string;(string) - Base64url encoded authenticator data
clientDataJSON
Section titled “clientDataJSON”clientDataJSON: string;(string) - Base64url encoded client data JSON
signature
Section titled “signature”signature: string;(string) - Base64url encoded assertion signature
userHandle?
Section titled “userHandle?”userHandle?: string;Base64url encoded user handle
AuthenticatorAttestationResponse
Section titled “AuthenticatorAttestationResponse”Properties
Section titled “Properties”attestationObject
Section titled “attestationObject”attestationObject: string;(string) - Base64url-encoded binary data
- Format - byte
authenticatorData?
Section titled “authenticatorData?”authenticatorData?: string;Base64url-encoded binary data Format - byte
clientDataJSON
Section titled “clientDataJSON”clientDataJSON: string;(string) - Base64url-encoded binary data
- Format - byte
publicKey?
Section titled “publicKey?”publicKey?: string;Base64url-encoded binary data Format - byte
publicKeyAlgorithm?
Section titled “publicKeyAlgorithm?”publicKeyAlgorithm?: number;The public key algorithm identifier Format - int64
transports?
Section titled “transports?”transports?: string[];The authenticator transports
AuthenticatorSelection
Section titled “AuthenticatorSelection”Properties
Section titled “Properties”authenticatorAttachment?
Section titled “authenticatorAttachment?”authenticatorAttachment?: AuthenticatorAttachment;The authenticator attachment modality
requireResidentKey?
Section titled “requireResidentKey?”requireResidentKey?: boolean;Whether the authenticator must create a client-side-resident public key credential source
residentKey?
Section titled “residentKey?”residentKey?: ResidentKeyRequirement;The resident key requirement
userVerification?
Section titled “userVerification?”userVerification?: UserVerificationRequirement;A requirement for user verification for the operation
Client
Section titled “Client”Properties
Section titled “Properties”baseURL
Section titled “baseURL”baseURL: string;Methods
Section titled “Methods”addSecurityKey()
Section titled “addSecurityKey()”addSecurityKey(options?: RequestInit): Promise<FetchResponse<PublicKeyCredentialCreationOptions>>;Summary: Initialize adding of a new webauthn security key Start the process of adding a new WebAuthn security key to the user’s account. Returns a challenge that must be completed by the user’s authenticator device. Requires elevated permissions.
This method may return different T based on the response code:
- 200: PublicKeyCredentialCreationOptions
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<PublicKeyCredentialCreationOptions>>
changeUserEmail()
Section titled “changeUserEmail()”changeUserEmail(body: UserEmailChangeRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Change user email Request to change the authenticated user’s email address. A verification email will be sent to the new address to confirm the change. Requires elevated permissions.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserEmailChangeRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
changeUserMfa()
Section titled “changeUserMfa()”changeUserMfa(options?: RequestInit): Promise<FetchResponse<TotpGenerateResponse>>;Summary: Generate TOTP secret Generate a Time-based One-Time Password (TOTP) secret for setting up multi-factor authentication
This method may return different T based on the response code:
- 200: TotpGenerateResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<TotpGenerateResponse>>
changeUserPassword()
Section titled “changeUserPassword()”changeUserPassword(body: UserPasswordRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Change user password Change the user’s password. The user must be authenticated with elevated permissions or provide a valid password reset ticket.
All of the user’s existing sessions are revoked atomically as part of this operation, including the session used to make the request. Clients must treat the user as signed out after a successful response and obtain a new session via sign-in.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserPasswordRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
changeUserPhoneNumber()
Section titled “changeUserPhoneNumber()”changeUserPhoneNumber(body: UserPhoneNumberChangeRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Change user phone number
Request to change the authenticated user’s phone number. A one-time password is sent
via SMS to the new phone number; complete the change by calling
/user/phone-number/change/verify with the OTP. The current phone_number is left
unchanged until verification succeeds. Requires elevated permissions.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserPhoneNumberChangeRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
createPAT()
Section titled “createPAT()”createPAT(body: CreatePATRequest, options?: RequestInit): Promise<FetchResponse<CreatePATResponse>>;Summary: Create a Personal Access Token (PAT) Generate a new Personal Access Token for programmatic API access. PATs are long-lived tokens that can be used instead of regular authentication for automated systems. Requires elevated permissions.
This method may return different T based on the response code:
- 200: CreatePATResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
CreatePATRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<CreatePATResponse>>
deanonymizeUser()
Section titled “deanonymizeUser()”deanonymizeUser(body: UserDeanonymizeRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Deanonymize an anonymous user Convert an anonymous user to a regular user by adding email and optionally password credentials. A confirmation email will be sent if the server is configured to do so.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserDeanonymizeRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
deanonymizeUserSms()
Section titled “deanonymizeUserSms()”deanonymizeUserSms(body: UserDeanonymizeSmsRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Deanonymize an anonymous user with SMS OTP
Convert an anonymous user to a regular user by adding a phone number. A one-time password is sent to the
phone number; the user completes verification by calling /signin/passwordless/sms/otp with the OTP, which
marks the phone number as verified and returns a session.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserDeanonymizeSmsRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
elevateOTPEmail()
Section titled “elevateOTPEmail()”elevateOTPEmail(options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Request a one-time password by email to elevate an already signed in user Send a one-time password to the signed in user’s email address to start elevation
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
elevateOTPSms()
Section titled “elevateOTPSms()”elevateOTPSms(options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Request a one-time password by SMS to elevate an already signed in user Send a one-time password to the signed in user’s verified phone number to start elevation
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
elevateTotp()
Section titled “elevateTotp()”elevateTotp(body: ElevateTotpRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Elevate access for an already signed in user using TOTP MFA Verify a TOTP code to elevate the permissions of an already signed in user
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
ElevateTotpRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
elevateWebauthn()
Section titled “elevateWebauthn()”elevateWebauthn(options?: RequestInit): Promise<FetchResponse<PublicKeyCredentialRequestOptions>>;Summary: Elevate access for an already signed in user using FIDO2 Webauthn Generate a Webauthn challenge for elevating user permissions
This method may return different T based on the response code:
- 200: PublicKeyCredentialRequestOptions
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<PublicKeyCredentialRequestOptions>>
getElevationMethods()
Section titled “getElevationMethods()”getElevationMethods(options?: RequestInit): Promise<FetchResponse<ElevationMethodsResponse>>;Summary: Get available elevation methods List the authenticated user’s available elevation methods, whether elevation is required under the configured mode, and whether the current session is elevated.
This method may return different T based on the response code:
- 200: ElevationMethodsResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<ElevationMethodsResponse>>
getJWKs()
Section titled “getJWKs()”getJWKs(options?: RequestInit): Promise<FetchResponse<JWKSet>>;Summary: Get public keys for JWT verification in JWK Set format Retrieve the JSON Web Key Set (JWKS) containing public keys used to verify JWT signatures. This endpoint is used by clients to validate access tokens.
This method may return different T based on the response code:
- 200: JWKSet
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<JWKSet>>
getOAuthAuthorizationServer()
Section titled “getOAuthAuthorizationServer()”getOAuthAuthorizationServer(options?: RequestInit): Promise<FetchResponse<OAuth2DiscoveryResponse>>;Summary: OAuth2 Authorization Server Metadata Returns the Authorization Server Metadata (RFC 8414). Same content as OpenID Discovery.
This method may return different T based on the response code:
- 200: OAuth2DiscoveryResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2DiscoveryResponse>>
getOpenIDConfiguration()
Section titled “getOpenIDConfiguration()”getOpenIDConfiguration(options?: RequestInit): Promise<FetchResponse<OAuth2DiscoveryResponse>>;Summary: OpenID Connect Discovery Returns the OpenID Provider Metadata (RFC 8414)
This method may return different T based on the response code:
- 200: OAuth2DiscoveryResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2DiscoveryResponse>>
getProviderTokens()
Section titled “getProviderTokens()”getProviderTokens(provider: SignInProvider, options?: RequestInit): Promise<FetchResponse<ProviderSession>>;Summary: Retrieve OAuth2 provider tokens from callback After successful OAuth2 authentication, retrieve the provider session containing access token, refresh token, and expiration information for the specified provider. To ensure the data isn’t stale this endpoint must be called immediately after the OAuth callback to obtain the tokens. The session is cleared from the database during this call, so subsequent calls will fail without going through the sign-in flow again. It is the user’s responsibility to store the session safely (e.g., in browser local storage).
This method may return different T based on the response code:
- 200: ProviderSession
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
SignInProvider |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<ProviderSession>>
getUser()
Section titled “getUser()”getUser(options?: RequestInit): Promise<FetchResponse<User>>;Summary: Get user information Retrieve the authenticated user’s profile information including roles, metadata, and account status.
This method may return different T based on the response code:
- 200: User
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<User>>
getVersion()
Section titled “getVersion()”getVersion(options?: RequestInit): Promise<FetchResponse<GetVersionResponse200>>;Summary: Get service version Retrieve version information about the authentication service
This method may return different T based on the response code:
- 200: GetVersionResponse200
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<GetVersionResponse200>>
healthCheckGet()
Section titled “healthCheckGet()”healthCheckGet(options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Health check (GET) Verify if the authentication service is operational using GET method
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
healthCheckHead()
Section titled “healthCheckHead()”healthCheckHead(options?: RequestInit): Promise<FetchResponse<void>>;Summary: Health check (HEAD) Verify if the authentication service is operational using HEAD method
This method may return different T based on the response code:
- 200: void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<void>>
linkIdToken()
Section titled “linkIdToken()”linkIdToken(body: LinkIdTokenRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Link a user account with the provider’s account using an id token Link the authenticated user’s account with an external OAuth provider account using an ID token. Requires elevated permissions.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
LinkIdTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
oauth2AuthorizePostURL()
Section titled “oauth2AuthorizePostURL()”oauth2AuthorizePostURL(body: Oauth2AuthorizePostBody, options?: RequestInit): string;Summary: OAuth2 Authorization Endpoint (POST) Initiates an OAuth2 authorization code flow via POST. Validates the request and redirects to the login UI for user authentication and consent.
As this method is a redirect, it returns a URL string instead of a Promise
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
Oauth2AuthorizePostBody |
options? |
RequestInit |
Returns
Section titled “Returns”string
oauth2AuthorizeURL()
Section titled “oauth2AuthorizeURL()”oauth2AuthorizeURL(params?: Oauth2AuthorizeParams, options?: RequestInit): string;Summary: OAuth2 Authorization Endpoint Initiates an OAuth2 authorization code flow. Validates the request and redirects to the login UI for user authentication and consent.
As this method is a redirect, it returns a URL string instead of a Promise
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params? |
Oauth2AuthorizeParams |
options? |
RequestInit |
Returns
Section titled “Returns”string
oauth2Introspect()
Section titled “oauth2Introspect()”oauth2Introspect(body: OAuth2IntrospectRequest, options?: RequestInit): Promise<FetchResponse<OAuth2IntrospectResponse>>;Summary: OAuth2 Token Introspection (RFC 7662) Introspect a token to determine its current state and metadata.
This method may return different T based on the response code:
- 200: OAuth2IntrospectResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
OAuth2IntrospectRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2IntrospectResponse>>
oauth2Jwks()
Section titled “oauth2Jwks()”oauth2Jwks(options?: RequestInit): Promise<FetchResponse<OAuth2JWKSResponse>>;Summary: OAuth2 Provider JWKS Endpoint Returns the JSON Web Key Set containing public keys used for OAuth2/OIDC token signing.
This method may return different T based on the response code:
- 200: OAuth2JWKSResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2JWKSResponse>>
oauth2LoginGet()
Section titled “oauth2LoginGet()”oauth2LoginGet(params?: Oauth2LoginGetParams, options?: RequestInit): Promise<FetchResponse<OAuth2LoginResponse>>;Summary: Get authorization request details for consent screen Called by the consent UI to get details about the pending authorization request.
This method may return different T based on the response code:
- 200: OAuth2LoginResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params? |
Oauth2LoginGetParams |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2LoginResponse>>
oauth2LoginPost()
Section titled “oauth2LoginPost()”oauth2LoginPost(body: OAuth2LoginRequest, options?: RequestInit): Promise<FetchResponse<OAuth2LoginCompleteResponse>>;Summary: Complete login/consent for an authorization request Called by the consent UI after user authenticates and consents. Sets the user on the auth request and redirects back to the client with an authorization code.
This method may return different T based on the response code:
- 200: OAuth2LoginCompleteResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
OAuth2LoginRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2LoginCompleteResponse>>
oauth2Revoke()
Section titled “oauth2Revoke()”oauth2Revoke(body: OAuth2RevokeRequest, options?: RequestInit): Promise<FetchResponse<void>>;Summary: OAuth2 Token Revocation (RFC 7009) Revoke an access token or refresh token.
This method may return different T based on the response code:
- 200: void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
OAuth2RevokeRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<void>>
oauth2Token()
Section titled “oauth2Token()”oauth2Token(body: OAuth2TokenRequest, options?: RequestInit): Promise<FetchResponse<OAuth2TokenResponse>>;Summary: OAuth2 Token Endpoint Exchange an authorization code for tokens, or refresh an existing token. Supports grant_type authorization_code and refresh_token.
This method may return different T based on the response code:
- 200: OAuth2TokenResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
OAuth2TokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2TokenResponse>>
oauth2UserinfoGet()
Section titled “oauth2UserinfoGet()”oauth2UserinfoGet(options?: RequestInit): Promise<FetchResponse<OAuth2UserinfoResponse>>;Summary: OpenID Connect UserInfo Endpoint (GET) Returns claims about the authenticated user based on the access token scopes.
This method may return different T based on the response code:
- 200: OAuth2UserinfoResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2UserinfoResponse>>
oauth2UserinfoPost()
Section titled “oauth2UserinfoPost()”oauth2UserinfoPost(options?: RequestInit): Promise<FetchResponse<OAuth2UserinfoResponse>>;Summary: OpenID Connect UserInfo Endpoint (POST) Returns claims about the authenticated user based on the access token scopes.
This method may return different T based on the response code:
- 200: OAuth2UserinfoResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<OAuth2UserinfoResponse>>
pushChainFunction()
Section titled “pushChainFunction()”pushChainFunction(chainFunction: ChainFunction): void;Add a middleware function to the fetch chain
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
chainFunction |
ChainFunction |
The middleware function to add |
Returns
Section titled “Returns”void
refreshProviderToken()
Section titled “refreshProviderToken()”refreshProviderToken( provider: SignInProvider, body: RefreshProviderTokenRequest, options?: RequestInit): Promise<FetchResponse<ProviderSession>>;Summary: Refresh OAuth2 provider tokens Refresh the OAuth2 provider access token using a valid refresh token. Returns a new provider session with updated access token, refresh token (if rotated by provider), and expiration information. This endpoint allows maintaining long-lived access to provider APIs without requiring the user to re-authenticate.
This method may return different T based on the response code:
- 200: ProviderSession
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
SignInProvider |
body |
RefreshProviderTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<ProviderSession>>
refreshToken()
Section titled “refreshToken()”refreshToken(body: RefreshTokenRequest, options?: RequestInit): Promise<FetchResponse<Session>>;Summary: Refresh access token Generate a new JWT access token using a valid refresh token. The refresh token used will be revoked and a new one will be issued.
This method may return different T based on the response code:
- 200: Session
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
RefreshTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<Session>>
sendPasswordResetEmail()
Section titled “sendPasswordResetEmail()”sendPasswordResetEmail(body: UserPasswordResetRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Request password reset Request a password reset for a user account. An email with a verification link will be sent to the user’s email address to complete the password reset process.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserPasswordResetRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
sendVerificationEmail()
Section titled “sendVerificationEmail()”sendVerificationEmail(body: UserEmailSendVerificationEmailRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Send verification email Send an email verification link to the specified email address. Used to verify email addresses for new accounts or email changes.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserEmailSendVerificationEmailRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signInAnonymous()
Section titled “signInAnonymous()”signInAnonymous(body?: SignInAnonymousRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Sign in anonymously
Create an anonymous user session without providing credentials. Anonymous users can be converted to regular users later via the deanonymize endpoint.
This endpoint always creates a new user and is not gated by AUTH_DISABLE_AUTO_SIGNUP; it is controlled by AUTH_DISABLE_SIGNUP and AUTH_ANONYMOUS_USERS_ENABLED.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body? |
SignInAnonymousRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
signInEmailPassword()
Section titled “signInEmailPassword()”signInEmailPassword(body: SignInEmailPasswordRequest, options?: RequestInit): Promise<FetchResponse<SignInEmailPasswordResponse>>;Summary: Sign in with email and password Authenticate a user with their email and password. Returns a session object or MFA challenge if two-factor authentication is enabled.
This method may return different T based on the response code:
- 200: SignInEmailPasswordResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInEmailPasswordRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SignInEmailPasswordResponse>>
signInIdToken()
Section titled “signInIdToken()”signInIdToken(body: SignInIdTokenRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Sign in with an ID token
Authenticate using an ID token from a supported OAuth provider (Apple or Google).
If the user doesn’t exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created.
When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/idtoken endpoint to register first.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInIdTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
signInOTPEmail()
Section titled “signInOTPEmail()”signInOTPEmail(body: SignInOTPEmailRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign in with email OTP
Initiate email-based one-time password authentication. Sends an OTP to the specified email address.
If the user doesn’t exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created with the provided options.
When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/otp/email endpoint to register first.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInOTPEmailRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signInPasswordlessEmail()
Section titled “signInPasswordlessEmail()”signInPasswordlessEmail(body: SignInPasswordlessEmailRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign in with magic link email
Initiate passwordless authentication by sending a magic link to the user’s email.
If the user doesn’t exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created with the provided options.
When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/passwordless/email endpoint to register first.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInPasswordlessEmailRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signInPasswordlessSms()
Section titled “signInPasswordlessSms()”signInPasswordlessSms(body: SignInPasswordlessSmsRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign in with SMS OTP
Initiate passwordless authentication by sending a one-time password to the user’s phone number.
If the user doesn’t exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created with the provided options.
When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/passwordless/sms endpoint to register first.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInPasswordlessSmsRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signInPAT()
Section titled “signInPAT()”signInPAT(body: SignInPATRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Sign in with Personal Access Token (PAT) Authenticate using a Personal Access Token. PATs are long-lived tokens that can be used for programmatic access to the API.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInPATRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
signInProviderURL()
Section titled “signInProviderURL()”signInProviderURL( provider: SignInProvider, params?: SignInProviderParams, options?: RequestInit): string;Summary: Sign in with an OAuth2 provider
Initiate OAuth2 authentication flow with a social provider. Redirects the user to the provider’s authorization page.
If the user doesn’t exist and AUTH_DISABLE_AUTO_SIGNUP is not set, a new account will be created upon callback.
When AUTH_DISABLE_AUTO_SIGNUP is enabled, users must use the /signup/provider/{provider} endpoint to register first.
As this method is a redirect, it returns a URL string instead of a Promise
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
SignInProvider |
params? |
SignInProviderParams |
options? |
RequestInit |
Returns
Section titled “Returns”string
signInWebauthn()
Section titled “signInWebauthn()”signInWebauthn(body?: SignInWebauthnRequest, options?: RequestInit): Promise<FetchResponse<PublicKeyCredentialRequestOptions>>;Summary: Sign in with Webauthn Initiate a Webauthn sign-in process by sending a challenge to the user’s device. The user must have previously registered a Webauthn credential.
This method may return different T based on the response code:
- 200: PublicKeyCredentialRequestOptions
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body? |
SignInWebauthnRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<PublicKeyCredentialRequestOptions>>
signOut()
Section titled “signOut()”signOut(body: SignOutRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign out End the current user session by invalidating refresh tokens. Optionally sign out from all devices.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignOutRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signUpEmailPassword()
Section titled “signUpEmailPassword()”signUpEmailPassword(body: SignUpEmailPasswordRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Sign up with email and password Register a new user account with email and password. Returns a session if email verification is not required, otherwise returns null session.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpEmailPasswordRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
signUpIdToken()
Section titled “signUpIdToken()”signUpIdToken(body: SignUpIdTokenRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Sign up with ID token
Register a new user account using an ID token from Apple or Google.
Use this endpoint to explicitly register a new account. When AUTH_DISABLE_AUTO_SIGNUP is enabled, this is the only way to register through this method.
If the user already exists, a user-already-exists error is returned.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpIdTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
signUpOTPEmail()
Section titled “signUpOTPEmail()”signUpOTPEmail(body: SignUpOTPEmailRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign up with email OTP
Register a new user account using email OTP authentication. Sends a one-time password to the specified email address.
Use this endpoint to explicitly register a new account. When AUTH_DISABLE_AUTO_SIGNUP is enabled, this is the only way to register through this method.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpOTPEmailRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signUpPasswordlessEmail()
Section titled “signUpPasswordlessEmail()”signUpPasswordlessEmail(body: SignUpPasswordlessEmailRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign up with magic link email
Register a new user account using passwordless email authentication. Sends a magic link to the specified email address for verification.
Use this endpoint to explicitly register a new account. When AUTH_DISABLE_AUTO_SIGNUP is enabled, this is the only way to register through this method.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpPasswordlessEmailRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signUpPasswordlessSms()
Section titled “signUpPasswordlessSms()”signUpPasswordlessSms(body: SignUpPasswordlessSmsRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Sign up with SMS OTP
Register a new user account using SMS OTP authentication. Sends a one-time password to the specified phone number.
Use this endpoint to explicitly register a new account. When AUTH_DISABLE_AUTO_SIGNUP is enabled, this is the only way to register through this method.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpPasswordlessSmsRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
signUpProviderURL()
Section titled “signUpProviderURL()”signUpProviderURL( provider: SignInProvider, params?: SignUpProviderParams, options?: RequestInit): string;Summary: Sign up with OAuth provider
Initiate OAuth signup flow with the specified provider. Redirects to the provider’s authorization page.
Use this endpoint to explicitly register a new account. When AUTH_DISABLE_AUTO_SIGNUP is enabled, this is the only way to register through this method.
If the user already exists at callback time, they are redirected with error=user-already-exists.
As this method is a redirect, it returns a URL string instead of a Promise
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
SignInProvider |
params? |
SignUpProviderParams |
options? |
RequestInit |
Returns
Section titled “Returns”string
signUpWebauthn()
Section titled “signUpWebauthn()”signUpWebauthn(body: SignUpWebauthnRequest, options?: RequestInit): Promise<FetchResponse<PublicKeyCredentialCreationOptions>>;Summary: Sign up with Webauthn Initiate a Webauthn sign-up process by sending a challenge to the user’s device. The user must not have an existing account.
This method may return different T based on the response code:
- 200: PublicKeyCredentialCreationOptions
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpWebauthnRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<PublicKeyCredentialCreationOptions>>
tokenExchange()
Section titled “tokenExchange()”tokenExchange(body: TokenExchangeRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Exchange authorization code for session Exchange an authorization code (obtained via PKCE flow) together with the original code_verifier for a session containing access and refresh tokens.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
TokenExchangeRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifyAddSecurityKey()
Section titled “verifyAddSecurityKey()”verifyAddSecurityKey(body: VerifyAddSecurityKeyRequest, options?: RequestInit): Promise<FetchResponse<VerifyAddSecurityKeyResponse>>;Summary: Verify adding of a new webauthn security key Complete the process of adding a new WebAuthn security key by verifying the authenticator response. Requires elevated permissions.
This method may return different T based on the response code:
- 200: VerifyAddSecurityKeyResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
VerifyAddSecurityKeyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<VerifyAddSecurityKeyResponse>>
verifyChangeUserMfa()
Section titled “verifyChangeUserMfa()”verifyChangeUserMfa(body: UserMfaRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Manage multi-factor authentication Activate or deactivate multi-factor authentication for the authenticated user
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserMfaRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
verifyChangeUserPhoneNumber()
Section titled “verifyChangeUserPhoneNumber()”verifyChangeUserPhoneNumber(body: UserPhoneNumberChangeVerifyRequest, options?: RequestInit): Promise<FetchResponse<"OK">>;Summary: Verify phone number change Complete a previously-requested phone number change by submitting the OTP that was sent via SMS. On success the staged phone number becomes the user’s verified phone number. Requires elevated permissions.
This method may return different T based on the response code:
- 200: OKResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
UserPhoneNumberChangeVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<"OK">>
verifyElevateOTPEmail()
Section titled “verifyElevateOTPEmail()”verifyElevateOTPEmail(body: ElevateOTPEmailVerifyRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Elevate access for an already signed in user using a one-time password sent by email Verify a one-time password sent by email to elevate the permissions of an already signed in user
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
ElevateOTPEmailVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifyElevateOTPSms()
Section titled “verifyElevateOTPSms()”verifyElevateOTPSms(body: ElevateOTPSmsVerifyRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Elevate access for an already signed in user using a one-time password sent by SMS Verify a one-time password sent by SMS to elevate the permissions of an already signed in user
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
ElevateOTPSmsVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifyElevateWebauthn()
Section titled “verifyElevateWebauthn()”verifyElevateWebauthn(body: SignInWebauthnVerifyRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Verify FIDO2 Webauthn authentication using public-key cryptography for elevation Complete Webauthn elevation by verifying the authentication response
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInWebauthnVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifySignInMfaTotp()
Section titled “verifySignInMfaTotp()”verifySignInMfaTotp(body: SignInMfaTotpRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Verify TOTP for MFA Complete the multi-factor authentication by verifying a Time-based One-Time Password (TOTP). Returns a session if validation is successful.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInMfaTotpRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifySignInOTPEmail()
Section titled “verifySignInOTPEmail()”verifySignInOTPEmail(body: SignInOTPEmailVerifyRequest, options?: RequestInit): Promise<FetchResponse<SignInOTPEmailVerifyResponse>>;Summary: Verify email OTP Complete email OTP authentication by verifying the one-time password. Returns a session if validation is successful.
This method may return different T based on the response code:
- 200: SignInOTPEmailVerifyResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInOTPEmailVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SignInOTPEmailVerifyResponse>>
verifySignInPasswordlessSms()
Section titled “verifySignInPasswordlessSms()”verifySignInPasswordlessSms(body: SignInPasswordlessSmsOtpRequest, options?: RequestInit): Promise<FetchResponse<SignInPasswordlessSmsOtpResponse>>;Summary: Verify SMS OTP and complete authentication Complete passwordless SMS authentication by verifying the one-time password and returning a session.
This method may return different T based on the response code:
- 200: SignInPasswordlessSmsOtpResponse
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInPasswordlessSmsOtpRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SignInPasswordlessSmsOtpResponse>>
verifySignInWebauthn()
Section titled “verifySignInWebauthn()”verifySignInWebauthn(body: SignInWebauthnVerifyRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Verify Webauthn sign-in Complete the Webauthn sign-in process by verifying the response from the user’s device. Returns a session if validation is successful.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignInWebauthnVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifySignUpWebauthn()
Section titled “verifySignUpWebauthn()”verifySignUpWebauthn(body: SignUpWebauthnVerifyRequest, options?: RequestInit): Promise<FetchResponse<SessionPayload>>;Summary: Verify Webauthn sign-up Complete the Webauthn sign-up process by verifying the response from the user’s device. Returns a session if validation is successful.
This method may return different T based on the response code:
- 200: SessionPayload
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
SignUpWebauthnVerifyRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<SessionPayload>>
verifyTicketURL()
Section titled “verifyTicketURL()”verifyTicketURL(params?: VerifyTicketParams, options?: RequestInit): string;Summary: Verify email and authentication tickets Verify tickets created by email verification, magic link authentication, or password reset processes. Redirects the user to the appropriate destination upon successful verification.
As this method is a redirect, it returns a URL string instead of a Promise
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params? |
VerifyTicketParams |
options? |
RequestInit |
Returns
Section titled “Returns”string
verifyToken()
Section titled “verifyToken()”verifyToken(body?: VerifyTokenRequest, options?: RequestInit): Promise<FetchResponse<string>>;Summary: Verify JWT token Verify the validity of a JWT access token. If no request body is provided, the Authorization header will be used for verification.
This method may return different T based on the response code:
- 200: string
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body? |
VerifyTokenRequest |
options? |
RequestInit |
Returns
Section titled “Returns”Promise<FetchResponse<string>>
CreatePATRequest
Section titled “CreatePATRequest”Properties
Section titled “Properties”expiresAt
Section titled “expiresAt”expiresAt: string;(string) - Expiration date of the PAT
- Format - date-time
metadata?
Section titled “metadata?”metadata?: Record<string, unknown>;Example - {"name":"my-pat","used-by":"my-app-cli"}
CreatePATResponse
Section titled “CreatePATResponse”Properties
Section titled “Properties”id: string;(string) - ID of the PAT
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
personalAccessToken
Section titled “personalAccessToken”personalAccessToken: string;(string) - PAT
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
CredentialAssertionResponse
Section titled “CredentialAssertionResponse”Properties
Section titled “Properties”authenticatorAttachment?
Section titled “authenticatorAttachment?”authenticatorAttachment?: string;The authenticator attachment
clientExtensionResults?
Section titled “clientExtensionResults?”clientExtensionResults?: AuthenticationExtensionsClientOutputs;Map of extension outputs from the client
id: string;(string) - The credential’s identifier
rawId: string;(string) - Base64url-encoded binary data
- Format - byte
response
Section titled “response”response: AuthenticatorAssertionResponse;(AuthenticatorAssertionResponse) -
type: string;(string) - The credential type represented by this object
CredentialCreationResponse
Section titled “CredentialCreationResponse”Properties
Section titled “Properties”authenticatorAttachment?
Section titled “authenticatorAttachment?”authenticatorAttachment?: string;The authenticator attachment
clientExtensionResults?
Section titled “clientExtensionResults?”clientExtensionResults?: AuthenticationExtensionsClientOutputs;Map of extension outputs from the client
id: string;(string) - The credential’s identifier
rawId: string;(string) - Base64url-encoded binary data
- Format - byte
response
Section titled “response”response: AuthenticatorAttestationResponse;(AuthenticatorAttestationResponse) -
type: string;(string) - The credential type represented by this object
CredentialParameter
Section titled “CredentialParameter”Properties
Section titled “Properties”alg: number;(number) - The cryptographic algorithm identifier
type: "public-key";(CredentialType) - The valid credential types
CredentialPropertiesOutput
Section titled “CredentialPropertiesOutput”Credential properties extension output
Properties
Section titled “Properties”rk?: boolean;Indicates if the credential is a resident key
ElevateOTPEmailVerifyRequest
Section titled “ElevateOTPEmailVerifyRequest”Properties
Section titled “Properties”otp: string;(string) - One time password
ElevateOTPSmsVerifyRequest
Section titled “ElevateOTPSmsVerifyRequest”Properties
Section titled “Properties”otp: string;(string) - One time password
ElevateTotpRequest
Section titled “ElevateTotpRequest”Properties
Section titled “Properties”otp: string;(string) - One time password
ElevationMethodsResponse
Section titled “ElevationMethodsResponse”Elevation status of the user
Properties
Section titled “Properties”elevationRequired
Section titled “elevationRequired”elevationRequired: boolean;(boolean) - Whether protected endpoints require an elevated session. When true and no methods are available, the user must set up a second factor first
- Example -
true
methods
Section titled “methods”methods: ElevationMethod[];(ElevationMethod[]) - Methods the user can use to elevate their session
- Example -
["webauthn","totp"]
sessionElevated
Section titled “sessionElevated”sessionElevated: boolean;(boolean) - Whether the bearer token has an elevated claim matching its subject
- Example -
false
ErrorResponse
Section titled “ErrorResponse”Standardized error response
Properties
Section titled “Properties”error: ErrorResponseError;(ErrorResponseError) - Error code identifying the specific application error
message
Section titled “message”message: string;(string) - Human-friendly error message
- Example -
"Invalid email format"
status
Section titled “status”status: number;(number) - HTTP status error code
- Example -
400
GetVersionResponse200
Section titled “GetVersionResponse200”Properties
Section titled “Properties”version
Section titled “version”version: string;(string) - The version of the authentication service
- Example -
"1.2.3"
JSON Web Key for JWT verification
Properties
Section titled “Properties”alg: string;(string) - Algorithm used with this key
- Example -
"RS256"
e: string;(string) - RSA public exponent
- Example -
"AQAB"
kid: string;(string) - Key ID
- Example -
"key-id-1"
kty: string;(string) - Key type
- Example -
"RSA"
n: string;(string) - RSA modulus
- Example -
"abcd1234..."
use: string;(string) - Key usage
- Example -
"sig"
JWKSet
Section titled “JWKSet”JSON Web Key Set for verifying JWT signatures
Properties
Section titled “Properties”keys: JWK[];(JWK[]) - Array of public keys
LinkIdTokenRequest
Section titled “LinkIdTokenRequest”Properties
Section titled “Properties”idToken
Section titled “idToken”idToken: string;(string) - Apple ID token
nonce?
Section titled “nonce?”nonce?: string;Nonce used during sign in process
provider
Section titled “provider”provider: IdTokenProvider;(IdTokenProvider) -
MFAChallengePayload
Section titled “MFAChallengePayload”Challenge payload for multi-factor authentication
Properties
Section titled “Properties”ticket
Section titled “ticket”ticket: string;(string) - Ticket to use when completing the MFA challenge
- Example -
"mfaTotp:abc123def456"
Oauth2AuthorizeParams
Section titled “Oauth2AuthorizeParams”Parameters for the oauth2Authorize method.
Properties
Section titled “Properties”client_id
Section titled “client_id”client_id: string;(string) - The OAuth2 client identifier (RFC 6749 Section 2.2).
code_challenge?
Section titled “code_challenge?”code_challenge?: string;PKCE code challenge derived from the code verifier (RFC 7636 Section 4.2).
code_challenge_method?
Section titled “code_challenge_method?”code_challenge_method?: "S256";Only S256 is supported. The plain method is not allowed.
nonce?
Section titled “nonce?”nonce?: string;String value used to associate a client session with an ID token (OpenID Connect Core Section 3.1.2.1).
prompt?
Section titled “prompt?”prompt?: string;Space-delimited list of prompts to present to the user (OpenID Connect Core Section 3.1.2.1).
redirect_uri
Section titled “redirect_uri”redirect_uri: string;(string) - The URI to redirect the user-agent to after authorization (RFC 6749 Section 3.1.2).
resource?
Section titled “resource?”resource?: string;Resource indicator for the target service (RFC 8707).
response_type
Section titled “response_type”response_type: string;(string) - The authorization response type. Only ‘code’ is supported (RFC 6749 Section 3.1.1).
scope?
Section titled “scope?”scope?: string;Space-delimited list of requested scopes (RFC 6749 Section 3.3).
state?
Section titled “state?”state?: string;Opaque value used to maintain state between the request and callback (RFC 6749 Section 4.1.1).
Oauth2AuthorizePostBody
Section titled “Oauth2AuthorizePostBody”Properties
Section titled “Properties”client_id
Section titled “client_id”client_id: string;(string) -
code_challenge?
Section titled “code_challenge?”code_challenge?: string;code_challenge_method?
Section titled “code_challenge_method?”code_challenge_method?: string;Only S256 is supported. The plain method is not allowed.
nonce?
Section titled “nonce?”nonce?: string;prompt?
Section titled “prompt?”prompt?: string;redirect_uri
Section titled “redirect_uri”redirect_uri: string;(string) -
resource?
Section titled “resource?”resource?: string;response_type
Section titled “response_type”response_type: string;(string) -
scope?
Section titled “scope?”scope?: string;state?
Section titled “state?”state?: string;OAuth2DiscoveryResponse
Section titled “OAuth2DiscoveryResponse”Properties
Section titled “Properties”authorization_endpoint
Section titled “authorization_endpoint”authorization_endpoint: string;(string) -
authorization_response_iss_parameter_supported?
Section titled “authorization_response_iss_parameter_supported?”authorization_response_iss_parameter_supported?: boolean;claims_supported?
Section titled “claims_supported?”claims_supported?: string[];client_id_metadata_document_supported?
Section titled “client_id_metadata_document_supported?”client_id_metadata_document_supported?: boolean;code_challenge_methods_supported?
Section titled “code_challenge_methods_supported?”code_challenge_methods_supported?: string[];grant_types_supported?
Section titled “grant_types_supported?”grant_types_supported?: string[];id_token_signing_alg_values_supported?
Section titled “id_token_signing_alg_values_supported?”id_token_signing_alg_values_supported?: string[];introspection_endpoint?
Section titled “introspection_endpoint?”introspection_endpoint?: string;issuer
Section titled “issuer”issuer: string;(string) -
jwks_uri
Section titled “jwks_uri”jwks_uri: string;(string) -
request_parameter_supported?
Section titled “request_parameter_supported?”request_parameter_supported?: boolean;response_types_supported
Section titled “response_types_supported”response_types_supported: string[];(string[]) -
revocation_endpoint?
Section titled “revocation_endpoint?”revocation_endpoint?: string;scopes_supported?
Section titled “scopes_supported?”scopes_supported?: string[];subject_types_supported?
Section titled “subject_types_supported?”subject_types_supported?: string[];token_endpoint
Section titled “token_endpoint”token_endpoint: string;(string) -
token_endpoint_auth_methods_supported?
Section titled “token_endpoint_auth_methods_supported?”token_endpoint_auth_methods_supported?: string[];userinfo_endpoint?
Section titled “userinfo_endpoint?”userinfo_endpoint?: string;OAuth2ErrorResponse
Section titled “OAuth2ErrorResponse”Properties
Section titled “Properties”error: string;(string) - OAuth2 error code
error_description?
Section titled “error_description?”error_description?: string;Human-readable error description
OAuth2IntrospectRequest
Section titled “OAuth2IntrospectRequest”Properties
Section titled “Properties”client_id?
Section titled “client_id?”client_id?: string;client_secret?
Section titled “client_secret?”client_secret?: string;token: string;(string) -
token_type_hint?
Section titled “token_type_hint?”token_type_hint?: OAuth2IntrospectRequestToken_type_hint;OAuth2IntrospectResponse
Section titled “OAuth2IntrospectResponse”Properties
Section titled “Properties”active
Section titled “active”active: boolean;(boolean) -
client_id?
Section titled “client_id?”client_id?: string;exp?: number;iat?: number;iss?: string;scope?
Section titled “scope?”scope?: string;sub?: string;token_type?
Section titled “token_type?”token_type?: string;OAuth2JWKSResponse
Section titled “OAuth2JWKSResponse”Properties
Section titled “Properties”keys: JWK[];(JWK[]) -
OAuth2LoginCompleteResponse
Section titled “OAuth2LoginCompleteResponse”Properties
Section titled “Properties”redirectUri
Section titled “redirectUri”redirectUri: string;(string) -
- Format - uri
Oauth2LoginGetParams
Section titled “Oauth2LoginGetParams”Parameters for the oauth2LoginGet method.
Properties
Section titled “Properties”request_id
Section titled “request_id”request_id: string;(string) - The pending authorization request identifier.
OAuth2LoginRequest
Section titled “OAuth2LoginRequest”Properties
Section titled “Properties”requestId
Section titled “requestId”requestId: string;(string) -
- Format - uuid
OAuth2LoginResponse
Section titled “OAuth2LoginResponse”Properties
Section titled “Properties”clientId
Section titled “clientId”clientId: string;(string) -
redirectUri
Section titled “redirectUri”redirectUri: string;(string) -
requestId
Section titled “requestId”requestId: string;(string) -
- Format - uuid
scopes
Section titled “scopes”scopes: string[];(string[]) -
OAuth2RevokeRequest
Section titled “OAuth2RevokeRequest”Properties
Section titled “Properties”client_id?
Section titled “client_id?”client_id?: string;client_secret?
Section titled “client_secret?”client_secret?: string;token: string;(string) -
token_type_hint?
Section titled “token_type_hint?”token_type_hint?: OAuth2RevokeRequestToken_type_hint;OAuth2TokenRequest
Section titled “OAuth2TokenRequest”Properties
Section titled “Properties”client_id?
Section titled “client_id?”client_id?: string;client_secret?
Section titled “client_secret?”client_secret?: string;code?: string;code_verifier?
Section titled “code_verifier?”code_verifier?: string;grant_type
Section titled “grant_type”grant_type: OAuth2TokenRequestGrant_type;(OAuth2TokenRequestGrant_type) -
redirect_uri?
Section titled “redirect_uri?”redirect_uri?: string;refresh_token?
Section titled “refresh_token?”refresh_token?: string;resource?
Section titled “resource?”resource?: string;OAuth2TokenResponse
Section titled “OAuth2TokenResponse”Properties
Section titled “Properties”access_token
Section titled “access_token”access_token: string;(string) -
expires_in
Section titled “expires_in”expires_in: number;(number) -
id_token?
Section titled “id_token?”id_token?: string;refresh_token?
Section titled “refresh_token?”refresh_token?: string;scope?
Section titled “scope?”scope?: string;token_type
Section titled “token_type”token_type: string;(string) -
OAuth2UserinfoResponse
Section titled “OAuth2UserinfoResponse”Properties
Section titled “Properties”email?
Section titled “email?”email?: string;email_verified?
Section titled “email_verified?”email_verified?: boolean;locale?
Section titled “locale?”locale?: string;name?: string;phone_number?
Section titled “phone_number?”phone_number?: string;phone_number_verified?
Section titled “phone_number_verified?”phone_number_verified?: boolean;picture?
Section titled “picture?”picture?: string;sub: string;(string) -
OptionsRedirectTo
Section titled “OptionsRedirectTo”Properties
Section titled “Properties”redirectTo?
Section titled “redirectTo?”redirectTo?: string;Example - "https://my-app.com/catch-redirection"
Format - uri
ProviderSession
Section titled “ProviderSession”OAuth2 provider session containing access and refresh tokens
Properties
Section titled “Properties”accessToken
Section titled “accessToken”accessToken: string;(string) - OAuth2 provider access token for API calls
- Example -
"ya29.a0AfH6SMBx..."
expiresAt
Section titled “expiresAt”expiresAt: string;(string) - Timestamp when the access token expires
- Example -
"2024-12-31T23:59:59Z" - Format - date-time
expiresIn
Section titled “expiresIn”expiresIn: number;(number) - Number of seconds until the access token expires
- Example -
3599
refreshToken?
Section titled “refreshToken?”refreshToken?: string;OAuth2 provider refresh token for obtaining new access tokens (if provided by the provider)
Example - "1//0gK8..."
ProviderSpecificParams
Section titled “ProviderSpecificParams”Properties
Section titled “Properties”connection?
Section titled “connection?”connection?: string;(workos) Specifies the connection to use for authentication
organization?
Section titled “organization?”organization?: string;(workos) Specifies the organization to use for authentication
PublicKeyCredentialCreationOptions
Section titled “PublicKeyCredentialCreationOptions”Properties
Section titled “Properties”attestation?
Section titled “attestation?”attestation?: ConveyancePreference;The attestation conveyance preference
attestationFormats?
Section titled “attestationFormats?”attestationFormats?: AttestationFormat[];The preferred attestation statement formats
authenticatorSelection?
Section titled “authenticatorSelection?”authenticatorSelection?: AuthenticatorSelection;challenge
Section titled “challenge”challenge: string;(string) - Base64url-encoded binary data
- Format - byte
excludeCredentials?
Section titled “excludeCredentials?”excludeCredentials?: PublicKeyCredentialDescriptor[];A list of PublicKeyCredentialDescriptor objects representing public key credentials that are not acceptable to the caller
extensions?
Section titled “extensions?”extensions?: Record<string, unknown>;Additional parameters requesting additional processing by the client and authenticator
hints?
Section titled “hints?”hints?: PublicKeyCredentialHints[];Hints to help guide the user through the experience
pubKeyCredParams
Section titled “pubKeyCredParams”pubKeyCredParams: CredentialParameter[];(CredentialParameter[]) - The desired credential types and their respective cryptographic parameters
rp: RelyingPartyEntity;(RelyingPartyEntity) -
timeout?
Section titled “timeout?”timeout?: number;A time, in milliseconds, that the caller is willing to wait for the call to complete
user: UserEntity;(UserEntity) -
PublicKeyCredentialDescriptor
Section titled “PublicKeyCredentialDescriptor”Properties
Section titled “Properties”id: string;(string) - Base64url-encoded binary data
- Format - byte
transports?
Section titled “transports?”transports?: AuthenticatorTransport[];The authenticator transports that can be used
type: "public-key";(CredentialType) - The valid credential types
PublicKeyCredentialRequestOptions
Section titled “PublicKeyCredentialRequestOptions”Properties
Section titled “Properties”allowCredentials?
Section titled “allowCredentials?”allowCredentials?: PublicKeyCredentialDescriptor[];A list of CredentialDescriptor objects representing public key credentials acceptable to the caller
challenge
Section titled “challenge”challenge: string;(string) - Base64url-encoded binary data
- Format - byte
extensions?
Section titled “extensions?”extensions?: Record<string, unknown>;Additional parameters requesting additional processing by the client and authenticator
hints?
Section titled “hints?”hints?: PublicKeyCredentialHints[];Hints to help guide the user through the experience
rpId?: string;The RP ID the credential should be scoped to
timeout?
Section titled “timeout?”timeout?: number;A time, in milliseconds, that the caller is willing to wait for the call to complete
userVerification?
Section titled “userVerification?”userVerification?: UserVerificationRequirement;A requirement for user verification for the operation
RefreshProviderTokenRequest
Section titled “RefreshProviderTokenRequest”Request to refresh OAuth2 provider tokens
Properties
Section titled “Properties”refreshToken
Section titled “refreshToken”refreshToken: string;(string) - OAuth2 provider refresh token obtained from previous authentication
- Example -
"1//0gK8..."
RefreshTokenRequest
Section titled “RefreshTokenRequest”Request to refresh an access token
Properties
Section titled “Properties”refreshToken
Section titled “refreshToken”refreshToken: string;(string) - Refresh token used to generate a new access token
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
RelyingPartyEntity
Section titled “RelyingPartyEntity”Properties
Section titled “Properties”id: string;(string) - A unique identifier for the Relying Party entity, which sets the RP ID
name: string;(string) - A human-palatable name for the entity
Session
Section titled “Session”User authentication session containing tokens and user information
Extended by
Section titled “Extended by”Properties
Section titled “Properties”accessToken
Section titled “accessToken”accessToken: string;(string) - JWT token for authenticating API requests
- Example -
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
accessTokenExpiresIn
Section titled “accessTokenExpiresIn”accessTokenExpiresIn: number;(number) - Expiration time of the access token in seconds
- Example -
900 - Format - int64
refreshToken
Section titled “refreshToken”refreshToken: string;(string) - Token used to refresh the access token
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
refreshTokenId
Section titled “refreshTokenId”refreshTokenId: string;(string) - Identifier for the refresh token
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
user?: User;User profile and account information
SessionPayload
Section titled “SessionPayload”Container for session information
Properties
Section titled “Properties”session?
Section titled “session?”session?: Session;User authentication session containing tokens and user information
SignInAnonymousRequest
Section titled “SignInAnonymousRequest”Properties
Section titled “Properties”displayName?
Section titled “displayName?”displayName?: string;Example - "John Smith"
locale?
Section titled “locale?”locale?: string;A two or three characters locale
Example - "en"
MinLength - 2
MaxLength - 3
metadata?
Section titled “metadata?”metadata?: Record<string, unknown>;Example - {"firstName":"John","lastName":"Smith"}
SignInEmailPasswordRequest
Section titled “SignInEmailPasswordRequest”Request to authenticate using email and password
Properties
Section titled “Properties”email: string;(string) - User’s email address
- Example -
"john.smith@nhost.io" - Format - email
password
Section titled “password”password: string;(string) - User’s password
- Example -
"Str0ngPassw#ord-94|%" - MinLength - 3
- MaxLength - 50
SignInEmailPasswordResponse
Section titled “SignInEmailPasswordResponse”Response for email-password authentication that may include a session or MFA challenge
Properties
Section titled “Properties”mfa?: MFAChallengePayload;Challenge payload for multi-factor authentication
session?
Section titled “session?”session?: Session;User authentication session containing tokens and user information
SignInIdTokenRequest
Section titled “SignInIdTokenRequest”Properties
Section titled “Properties”idToken
Section titled “idToken”idToken: string;(string) - Apple ID token
nonce?
Section titled “nonce?”nonce?: string;Nonce used during sign in process
options?
Section titled “options?”options?: SignUpOptions;provider
Section titled “provider”provider: IdTokenProvider;(IdTokenProvider) -
SignInMfaTotpRequest
Section titled “SignInMfaTotpRequest”Properties
Section titled “Properties”otp: string;(string) - One time password
ticket
Section titled “ticket”ticket: string;(string) - Ticket
- Pattern - ^mfaTotp:.*$
SignInOTPEmailRequest
Section titled “SignInOTPEmailRequest”Properties
Section titled “Properties”email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;SignInOTPEmailVerifyRequest
Section titled “SignInOTPEmailVerifyRequest”Properties
Section titled “Properties”email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
otp: string;(string) - One time password
SignInOTPEmailVerifyResponse
Section titled “SignInOTPEmailVerifyResponse”Properties
Section titled “Properties”session?
Section titled “session?”session?: Session;User authentication session containing tokens and user information
SignInPasswordlessEmailRequest
Section titled “SignInPasswordlessEmailRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;SignInPasswordlessSmsOtpRequest
Section titled “SignInPasswordlessSmsOtpRequest”Properties
Section titled “Properties”otp: string;(string) - One-time password received by SMS
phoneNumber
Section titled “phoneNumber”phoneNumber: string;(string) - Phone number of the user
- Example -
"+123456789"
SignInPasswordlessSmsOtpResponse
Section titled “SignInPasswordlessSmsOtpResponse”Properties
Section titled “Properties”mfa?: MFAChallengePayload;Challenge payload for multi-factor authentication
session?
Section titled “session?”session?: Session;User authentication session containing tokens and user information
SignInPasswordlessSmsRequest
Section titled “SignInPasswordlessSmsRequest”Properties
Section titled “Properties”options?
Section titled “options?”options?: SignUpOptions;phoneNumber
Section titled “phoneNumber”phoneNumber: string;(string) - Phone number of the user
- Example -
"+123456789"
SignInPATRequest
Section titled “SignInPATRequest”Properties
Section titled “Properties”personalAccessToken
Section titled “personalAccessToken”personalAccessToken: string;(string) - PAT
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
SignInProviderParams
Section titled “SignInProviderParams”Parameters for the signInProvider method.
Properties
Section titled “Properties”allowedRoles?
Section titled “allowedRoles?”allowedRoles?: string[];Array of allowed roles for the user
codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the callback redirect will contain an authorization code instead of a refresh token.
connect?
Section titled “connect?”connect?: string;If set, this means that the user is already authenticated and wants to link their account. This needs to be a valid JWT access token.
defaultRole?
Section titled “defaultRole?”defaultRole?: string;Default role for the user
displayName?
Section titled “displayName?”displayName?: string;Display name for the user
locale?
Section titled “locale?”locale?: string;A two or three characters locale
metadata?
Section titled “metadata?”metadata?: Record<string, unknown>;Additional metadata for the user (JSON encoded string)
providerSpecificParams?
Section titled “providerSpecificParams?”providerSpecificParams?: ProviderSpecificParams;Additional provider-specific parameters
redirectTo?
Section titled “redirectTo?”redirectTo?: string;URI to redirect to
state?
Section titled “state?”state?: string;Opaque state value to be returned by the provider
upstreamParams?
Section titled “upstreamParams?”upstreamParams?: Record<string, string>;Extra parameters forwarded to the upstream OAuth2 provider’s authorization URL. Reserved OAuth2/OIDC parameters are rejected.
- Extra parameters forwarded to the upstream OAuth2 provider’s authorization URL (e.g. Google’s prompt or login_hint). Reserved OAuth2/OIDC parameters are rejected.
SignInWebauthnRequest
Section titled “SignInWebauthnRequest”Properties
Section titled “Properties”email?
Section titled “email?”email?: string;A valid email
Example - "john.smith@nhost.io"
Format - email
SignInWebauthnVerifyRequest
Section titled “SignInWebauthnVerifyRequest”Properties
Section titled “Properties”credential
Section titled “credential”credential: CredentialAssertionResponse;(CredentialAssertionResponse) -
email?
Section titled “email?”email?: string;A valid email. Deprecated, no longer used
Example - "john.smith@nhost.io"
Format - email
SignOutRequest
Section titled “SignOutRequest”Properties
Section titled “Properties”all?: boolean;Sign out from all connected devices
refreshToken?
Section titled “refreshToken?”refreshToken?: string;Refresh token for the current session
SignUpEmailPasswordRequest
Section titled “SignUpEmailPasswordRequest”Request to register a new user with email and password
Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided and email verification is required, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
email: string;(string) - Email address for the new user account
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;password
Section titled “password”password: string;(string) - Password for the new user account
- Example -
"Str0ngPassw#ord-94|%" - MinLength - 3
- MaxLength - 50
SignUpIdTokenRequest
Section titled “SignUpIdTokenRequest”Properties
Section titled “Properties”idToken
Section titled “idToken”idToken: string;(string) - Apple or Google ID token
nonce?
Section titled “nonce?”nonce?: string;Nonce used during sign in process
options?
Section titled “options?”options?: SignUpOptions;provider
Section titled “provider”provider: IdTokenProvider;(IdTokenProvider) -
SignUpOptions
Section titled “SignUpOptions”Properties
Section titled “Properties”allowedRoles?
Section titled “allowedRoles?”allowedRoles?: string[];Example - ["me","user"]
defaultRole?
Section titled “defaultRole?”defaultRole?: string;Example - "user"
displayName?
Section titled “displayName?”displayName?: string;Example - "John Smith"
Pattern - ^[\p{L}\p{N}\p{S} ,.’-]+$
MaxLength - 32
locale?
Section titled “locale?”locale?: string;A two or three characters locale
Example - "en"
MinLength - 2
MaxLength - 3
metadata?
Section titled “metadata?”metadata?: Record<string, unknown>;Example - {"firstName":"John","lastName":"Smith"}
redirectTo?
Section titled “redirectTo?”redirectTo?: string;Example - "https://my-app.com/catch-redirection"
Format - uri
SignUpOTPEmailRequest
Section titled “SignUpOTPEmailRequest”Properties
Section titled “Properties”email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;SignUpPasswordlessEmailRequest
Section titled “SignUpPasswordlessEmailRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;SignUpPasswordlessSmsRequest
Section titled “SignUpPasswordlessSmsRequest”Properties
Section titled “Properties”options?
Section titled “options?”options?: SignUpOptions;phoneNumber
Section titled “phoneNumber”phoneNumber: string;(string) - Phone number of the user
- Example -
"+123456789"
SignUpProviderParams
Section titled “SignUpProviderParams”Parameters for the signUpProvider method.
Properties
Section titled “Properties”allowedRoles?
Section titled “allowedRoles?”allowedRoles?: string[];Array of allowed roles for the user
codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the callback redirect will contain an authorization code instead of a refresh token.
defaultRole?
Section titled “defaultRole?”defaultRole?: string;Default role for the user
displayName?
Section titled “displayName?”displayName?: string;Display name for the user
locale?
Section titled “locale?”locale?: string;A two or three characters locale
metadata?
Section titled “metadata?”metadata?: Record<string, unknown>;Additional metadata for the user (JSON encoded string)
providerSpecificParams?
Section titled “providerSpecificParams?”providerSpecificParams?: ProviderSpecificParams;Additional provider-specific parameters
redirectTo?
Section titled “redirectTo?”redirectTo?: string;URI to redirect to
state?
Section titled “state?”state?: string;Opaque state value to be returned by the provider
upstreamParams?
Section titled “upstreamParams?”upstreamParams?: Record<string, string>;Extra parameters forwarded to the upstream OAuth2 provider’s authorization URL. Reserved OAuth2/OIDC parameters are rejected.
- Extra parameters forwarded to the upstream OAuth2 provider’s authorization URL (e.g. Google’s prompt or login_hint). Reserved OAuth2/OIDC parameters are rejected.
SignUpWebauthnRequest
Section titled “SignUpWebauthnRequest”Properties
Section titled “Properties”email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;SignUpWebauthnVerifyRequest
Section titled “SignUpWebauthnVerifyRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided and email verification is required, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
credential
Section titled “credential”credential: CredentialCreationResponse;(CredentialCreationResponse) -
nickname?
Section titled “nickname?”nickname?: string;Nickname for the security key
options?
Section titled “options?”options?: SignUpOptions;TokenExchangeRequest
Section titled “TokenExchangeRequest”Request to exchange an authorization code for a session using PKCE
Properties
Section titled “Properties”code: string;(string) - The authorization code received from the redirect
codeVerifier
Section titled “codeVerifier”codeVerifier: string;(string) - The original PKCE code verifier (43-128 characters)
- MinLength - 43
- MaxLength - 128
TotpGenerateResponse
Section titled “TotpGenerateResponse”Response containing TOTP setup information for MFA
Properties
Section titled “Properties”imageUrl
Section titled “imageUrl”imageUrl: string;(string) - URL to QR code image for scanning with an authenticator app
- Example -
"data:image/png;base64,iVBORw0KGg..."
totpSecret
Section titled “totpSecret”totpSecret: string;(string) - TOTP secret key for manual setup with an authenticator app
- Example -
"ABCDEFGHIJK23456"
User profile and account information
Properties
Section titled “Properties”activeMfaType?
Section titled “activeMfaType?”activeMfaType?: string;Active MFA type for the user
avatarUrl
Section titled “avatarUrl”avatarUrl: string;(string) - URL to the user’s profile picture
- Example -
"https://myapp.com/avatars/user123.jpg"
createdAt
Section titled “createdAt”createdAt: string;(string) - Timestamp when the user account was created
- Example -
"2023-01-15T12:34:56Z" - Format - date-time
defaultRole
Section titled “defaultRole”defaultRole: string;(string) - Default authorization role for the user
- Example -
"user"
displayName
Section titled “displayName”displayName: string;(string) - User’s display name
- Example -
"John Smith"
email?
Section titled “email?”email?: string;User’s email address
Example - "john.smith@nhost.io"
Format - email
emailVerified
Section titled “emailVerified”emailVerified: boolean;(boolean) - Whether the user’s email has been verified
- Example -
true
id: string;(string) - Unique identifier for the user
- Example -
"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24" - Pattern - \b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
isAnonymous
Section titled “isAnonymous”isAnonymous: boolean;(boolean) - Whether this is an anonymous user account
- Example -
false
locale
Section titled “locale”locale: string;(string) - User’s preferred locale (language code)
- Example -
"en" - MinLength - 2
- MaxLength - 3
metadata
Section titled “metadata”metadata: Record<string, unknown> | null;(Record<string, unknown> | null) - Custom metadata associated with the user
- Example -
{"firstName":"John","lastName":"Smith"}
phoneNumber?
Section titled “phoneNumber?”phoneNumber?: string;User’s phone number
Example - "+12025550123"
phoneNumberVerified
Section titled “phoneNumberVerified”phoneNumberVerified: boolean;(boolean) - Whether the user’s phone number has been verified
- Example -
false
roles: string[];(string[]) - List of roles assigned to the user
- Example -
["user","customer"]
UserDeanonymizeRequest
Section titled “UserDeanonymizeRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
connection?
Section titled “connection?”connection?: string;Deprecated, will be ignored
email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: SignUpOptions;password?
Section titled “password?”password?: string;A password of minimum 3 characters
Example - "Str0ngPassw#ord-94|%"
MinLength - 3
MaxLength - 50
signInMethod
Section titled “signInMethod”signInMethod: UserDeanonymizeRequestSignInMethod;(UserDeanonymizeRequestSignInMethod) - Which sign-in method to use
UserDeanonymizeSmsRequest
Section titled “UserDeanonymizeSmsRequest”Properties
Section titled “Properties”options?
Section titled “options?”options?: SignUpOptions;phoneNumber
Section titled “phoneNumber”phoneNumber: string;(string) - Phone number of the user
- Example -
"+123456789"
UserEmailChangeRequest
Section titled “UserEmailChangeRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
newEmail
Section titled “newEmail”newEmail: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: OptionsRedirectTo;UserEmailSendVerificationEmailRequest
Section titled “UserEmailSendVerificationEmailRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: OptionsRedirectTo;UserEntity
Section titled “UserEntity”Properties
Section titled “Properties”displayName
Section titled “displayName”displayName: string;(string) - A human-palatable name for the user account, intended only for display
id: string;(string) - The user handle of the user account entity
name: string;(string) - A human-palatable name for the entity
UserMfaRequest
Section titled “UserMfaRequest”Request to activate or deactivate multi-factor authentication
Properties
Section titled “Properties”activeMfaType?
Section titled “activeMfaType?”activeMfaType?: UserMfaRequestActiveMfaType;Type of MFA to activate. Use empty string to disable MFA.
Example - "totp"
code: string;(string) - Verification code from the authenticator app when activating MFA
- Example -
"123456"
UserPasswordRequest
Section titled “UserPasswordRequest”Properties
Section titled “Properties”newPassword
Section titled “newPassword”newPassword: string;(string) - A password of minimum 3 characters
- Example -
"Str0ngPassw#ord-94|%" - MinLength - 3
- MaxLength - 50
ticket?
Section titled “ticket?”ticket?: string;Ticket to reset the password, required if the user is not authenticated Pattern - ^passwordReset:.*$
UserPasswordResetRequest
Section titled “UserPasswordResetRequest”Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When provided, the verification redirect will contain an authorization code instead of a refresh token. Pattern - ^[A-Za-z0-9_-]{43}$ MinLength - 43 MaxLength - 43
email: string;(string) - A valid email
- Example -
"john.smith@nhost.io" - Format - email
options?
Section titled “options?”options?: OptionsRedirectTo;UserPhoneNumberChangeRequest
Section titled “UserPhoneNumberChangeRequest”Properties
Section titled “Properties”newPhoneNumber
Section titled “newPhoneNumber”newPhoneNumber: string;(string) - New phone number to bind to the user once verified via SMS OTP
- Example -
"+123456789"
UserPhoneNumberChangeVerifyRequest
Section titled “UserPhoneNumberChangeVerifyRequest”Properties
Section titled “Properties”newPhoneNumber
Section titled “newPhoneNumber”newPhoneNumber: string;(string) - The phone number that was previously requested via /user/phone-number/change
- Example -
"+123456789"
otp: string;(string) - One-time password received via SMS at the new phone number
- Example -
"123456"
VerifyAddSecurityKeyRequest
Section titled “VerifyAddSecurityKeyRequest”Properties
Section titled “Properties”credential
Section titled “credential”credential: CredentialCreationResponse;(CredentialCreationResponse) -
nickname?
Section titled “nickname?”nickname?: string;Optional nickname for the security key
VerifyAddSecurityKeyResponse
Section titled “VerifyAddSecurityKeyResponse”Properties
Section titled “Properties”id: string;(string) - The ID of the newly added security key
- Example -
"123e4567-e89b-12d3-a456-426614174000"
nickname?
Section titled “nickname?”nickname?: string;The nickname of the security key if provided
VerifyTicketParams
Section titled “VerifyTicketParams”Parameters for the verifyTicket method.
Properties
Section titled “Properties”codeChallenge?
Section titled “codeChallenge?”codeChallenge?: string;PKCE code challenge (S256). When present, the redirect will contain an authorization code instead of a refresh token.
redirectTo
Section titled “redirectTo”redirectTo: string;(RedirectToQuery) - Target URL for the redirect
- Target URL for the redirect
ticket
Section titled “ticket”ticket: string;(TicketQuery) - Ticket
- Ticket
type?: TicketTypeQuery;Type of the ticket. Deprecated, no longer used
- Type of the ticket
VerifyTokenRequest
Section titled “VerifyTokenRequest”Properties
Section titled “Properties”token?
Section titled “token?”token?: string;JWT token to verify
Type Aliases
Section titled “Type Aliases”AttestationFormat
Section titled “AttestationFormat”type AttestationFormat = | "packed" | "tpm" | "android-key" | "android-safetynet" | "fido-u2f" | "apple" | "none";The attestation statement format
AuthenticatorAttachment
Section titled “AuthenticatorAttachment”type AuthenticatorAttachment = "platform" | "cross-platform";The authenticator attachment modality
AuthenticatorTransport
Section titled “AuthenticatorTransport”type AuthenticatorTransport = "usb" | "nfc" | "ble" | "smart-card" | "hybrid" | "internal";The authenticator transports that can be used
ConveyancePreference
Section titled “ConveyancePreference”type ConveyancePreference = "none" | "indirect" | "direct" | "enterprise";The attestation conveyance preference
CredentialType
Section titled “CredentialType”type CredentialType = "public-key";The valid credential types
ElevationMethod
Section titled “ElevationMethod”type ElevationMethod = "webauthn" | "totp" | "otp-email" | "otp-sms";Method that can be used to elevate a session
ErrorResponseError
Section titled “ErrorResponseError”type ErrorResponseError = | "default-role-must-be-in-allowed-roles" | "disabled-endpoint" | "disabled-user" | "user-already-exists" | "email-already-verified" | "forbidden-anonymous" | "internal-server-error" | "invalid-email-password" | "invalid-request" | "locale-not-allowed" | "password-too-short" | "password-in-hibp-database" | "redirectTo-not-allowed" | "role-not-allowed" | "signup-disabled" | "unverified-user" | "user-not-anonymous" | "invalid-pat" | "invalid-refresh-token" | "invalid-ticket" | "disabled-mfa-totp" | "no-totp-secret" | "invalid-totp" | "mfa-type-not-found" | "totp-already-active" | "invalid-state" | "oauth-token-echange-failed" | "oauth-profile-fetch-failed" | "oauth-provider-error" | "invalid-otp" | "otp-too-many-attempts" | "cannot-send-sms" | "provider-account-already-linked";Error code identifying the specific application error
GetCode_challenge_method
Section titled “GetCode_challenge_method”type GetCode_challenge_method = "S256";IdTokenProvider
Section titled “IdTokenProvider”type IdTokenProvider = "apple" | "google";OAuth2IntrospectRequestToken_type_hint
Section titled “OAuth2IntrospectRequestToken_type_hint”type OAuth2IntrospectRequestToken_type_hint = "access_token" | "refresh_token";OAuth2RevokeRequestToken_type_hint
Section titled “OAuth2RevokeRequestToken_type_hint”type OAuth2RevokeRequestToken_type_hint = "access_token" | "refresh_token";OAuth2TokenRequestGrant_type
Section titled “OAuth2TokenRequestGrant_type”type OAuth2TokenRequestGrant_type = "authorization_code" | "refresh_token";OKResponse
Section titled “OKResponse”type OKResponse = "OK";PublicKeyCredentialHints
Section titled “PublicKeyCredentialHints”type PublicKeyCredentialHints = "security-key" | "client-device" | "hybrid";Hints to help guide the user through the experience
RedirectToQuery
Section titled “RedirectToQuery”type RedirectToQuery = string;Target URL for the redirect
ResidentKeyRequirement
Section titled “ResidentKeyRequirement”type ResidentKeyRequirement = "discouraged" | "preferred" | "required";The resident key requirement
SignInProvider
Section titled “SignInProvider”type SignInProvider = | "apple" | "github" | "google" | "linkedin" | "discord" | "spotify" | "twitch" | "gitlab" | "bitbucket" | "workos" | "azuread" | "entraid" | "strava" | "facebook" | "windowslive" | "twitter";TicketQuery
Section titled “TicketQuery”type TicketQuery = string;Ticket
TicketTypeQuery
Section titled “TicketTypeQuery”type TicketTypeQuery = "emailVerify" | "emailConfirmChange" | "signinPasswordless" | "passwordReset";Type of the ticket
URLEncodedBase64
Section titled “URLEncodedBase64”type URLEncodedBase64 = string;Base64url-encoded binary data
UserDeanonymizeRequestSignInMethod
Section titled “UserDeanonymizeRequestSignInMethod”type UserDeanonymizeRequestSignInMethod = "email-password" | "passwordless";Which sign-in method to use
UserMfaRequestActiveMfaType
Section titled “UserMfaRequestActiveMfaType”type UserMfaRequestActiveMfaType = "totp" | "";Type of MFA to activate. Use empty string to disable MFA.
UserVerificationRequirement
Section titled “UserVerificationRequirement”type UserVerificationRequirement = "required" | "preferred" | "discouraged";A requirement for user verification for the operation
Functions
Section titled “Functions”createAPIClient()
Section titled “createAPIClient()”function createAPIClient( baseURL: string, chainFunctions?: ChainFunction[],): Client;Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
baseURL |
string |
undefined |
chainFunctions? |
ChainFunction[] |
[] |
Returns
Section titled “Returns”generateCodeChallenge()
Section titled “generateCodeChallenge()”function generateCodeChallenge(verifier: string): Promise<string>;Derive a S256 code challenge from a code verifier.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
verifier |
string |
Returns
Section titled “Returns”Promise<string>
generateCodeVerifier()
Section titled “generateCodeVerifier()”function generateCodeVerifier(): string;Generate a cryptographically random PKCE code verifier (43 base64url characters).
Returns
Section titled “Returns”string
generatePKCEPair()
Section titled “generatePKCEPair()”function generatePKCEPair(): Promise<{ challenge: string; verifier: string;}>;Generate a PKCE code verifier and its S256 challenge in one call.
Returns
Section titled “Returns”Promise<{
challenge: string;
verifier: string;
}>