@auth0/auth0-server-js 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, TokenResponse } from '@auth0/auth0-auth-js';
2
- export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OrganizationValidationError, OtpEnrollmentResponse, PasskeyChallengeError, PasskeyLoginChallengeOptions as PasskeyChallengeOptions, PasskeyLoginChallengeResponse as PasskeyChallengeResponse, PasskeyCreationOptions, PasskeyCredentialResponse, PasskeyGetTokenError, GetTokenByPasskeyOptions as PasskeyGetTokenOptions, PasskeyRegisterError, PasskeySignupChallengeOptions as PasskeyRegisterOptions, PasskeySignupChallengeResponse as PasskeyRegisterResponse, PasskeyRequestOptions, TelemetryConfig, TokenExchangeError, TokenResponse, isMfaRequiredError } from '@auth0/auth0-auth-js';
1
+ import { AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, SignUpOptions, SignUpResult, ChangePasswordOptions, TokenResponse } from '@auth0/auth0-auth-js';
2
+ export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, ChangePasswordError, ChangePasswordOptions, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OrganizationValidationError, OtpEnrollmentResponse, PasskeyChallengeError, PasskeyLoginChallengeOptions as PasskeyChallengeOptions, PasskeyLoginChallengeResponse as PasskeyChallengeResponse, PasskeyCreationOptions, PasskeyCredentialResponse, PasskeyGetTokenError, GetTokenByPasskeyOptions as PasskeyGetTokenOptions, PasskeyRegisterError, PasskeySignupChallengeOptions as PasskeyRegisterOptions, PasskeySignupChallengeResponse as PasskeyRegisterResponse, PasskeyRequestOptions, SignUpError, SignUpOptions, SignUpResult, TelemetryConfig, TokenExchangeError, TokenResponse, TokenRevocationError, isMfaRequiredError } from '@auth0/auth0-auth-js';
3
3
  import { JWTPayload } from 'jose';
4
4
 
5
5
  /**
@@ -26,6 +26,12 @@ interface ServerClientOptions<TStoreOptions = unknown> {
26
26
  clientAssertionSigningKey?: string | CryptoKey;
27
27
  clientAssertionSigningAlg?: string;
28
28
  authorizationParams?: AuthorizationParameters;
29
+ /**
30
+ * Default organization for all interactive login flows from this client.
31
+ * Can be an organization ID (e.g. `org_abc123`) or an organization name (e.g. `acme-corp`).
32
+ * A per-login value in {@link StartInteractiveLoginOptions} overrides this.
33
+ */
34
+ organization?: string;
29
35
  discoveryCache?: DiscoveryCacheOptions;
30
36
  transactionIdentifier?: string;
31
37
  stateIdentifier?: string;
@@ -57,12 +63,19 @@ interface UserClaims {
57
63
  email?: string;
58
64
  email_verified?: boolean;
59
65
  org_id?: string;
66
+ org_name?: string;
60
67
  [key: string]: unknown;
61
68
  }
62
69
  interface AuthorizationParameters {
63
70
  scope?: string;
64
71
  audience?: string;
65
72
  redirect_uri?: string;
73
+ /**
74
+ * The organization to log the user into. Prefer the first-class `organization`
75
+ * option on {@link StartInteractiveLoginOptions} / {@link ServerClientOptions};
76
+ * this is supported for backwards compatibility.
77
+ */
78
+ organization?: string;
66
79
  [key: string]: unknown;
67
80
  }
68
81
  interface TokenSet {
@@ -112,6 +125,11 @@ interface TransactionData {
112
125
  */
113
126
  codeVerifier?: string;
114
127
  domain?: string;
128
+ /**
129
+ * The organization requested at login, carried across the redirect so the
130
+ * returned ID token's organization claim can be validated at callback.
131
+ */
132
+ organization?: string;
115
133
  [key: string]: unknown;
116
134
  }
117
135
  interface AbstractDataStore<TData, TStoreOptions = unknown> {
@@ -146,6 +164,18 @@ interface StartInteractiveLoginOptions<TAppState = unknown> {
146
164
  pushedAuthorizationRequests?: boolean;
147
165
  appState?: TAppState;
148
166
  authorizationParams?: AuthorizationParameters;
167
+ /**
168
+ * The organization to log the user into. Overrides the client-level
169
+ * `organization` default. Can be an organization ID (`org_abc123`) or name
170
+ * (`acme-corp`). Also passable via `authorizationParams.organization`.
171
+ */
172
+ organization?: string;
173
+ /**
174
+ * The organization invitation ticket, when handling an invitation-acceptance flow.
175
+ * Requires `organization` to be set (per-login, client-level default, or via
176
+ * `authorizationParams`); providing `invitation` without an organization throws.
177
+ */
178
+ invitation?: string;
149
179
  }
150
180
  interface LoginBackchannelOptions {
151
181
  bindingMessage: string;
@@ -300,6 +330,13 @@ interface GetAccessTokenOptions {
300
330
  */
301
331
  scope?: string;
302
332
  }
333
+ interface RevokeRefreshTokenOptions {
334
+ /**
335
+ * Explicitly provide a refresh token to revoke.
336
+ * If omitted, the token stored in the current session is used.
337
+ */
338
+ token?: string;
339
+ }
303
340
  interface LogoutOptions {
304
341
  returnTo: string;
305
342
  }
@@ -572,6 +609,59 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
572
609
  getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
573
610
  }
574
611
 
612
+ /**
613
+ * @internal
614
+ * Options for constructing a ServerDatabaseClient.
615
+ *
616
+ * Like the passkey client, the database client resolves the domain per call so
617
+ * it keeps working in resolver (multi-tenant) mode. It therefore receives the
618
+ * parent client's `resolveDomain` and `getAuthClient` helpers instead of a
619
+ * fixed domain/authClient. Unlike the MFA/passkey clients, it never touches the
620
+ * state store — signup and change-password write no session.
621
+ */
622
+ interface ServerDatabaseClientOptions<TStoreOptions = unknown> {
623
+ resolveDomain: (storeOptions?: TStoreOptions) => Promise<string>;
624
+ getAuthClient: (domain: string) => AuthClient;
625
+ }
626
+
627
+ declare class ServerDatabaseClient<TStoreOptions = unknown> {
628
+ #private;
629
+ /**
630
+ * @internal
631
+ */
632
+ constructor(options: ServerDatabaseClientOptions<TStoreOptions>);
633
+ /**
634
+ * Registers a new user in a database connection.
635
+ *
636
+ * Delegates to the underlying `AuthClient.database.signUp` without any session
637
+ * state modification. The caller is responsible for handling the returned user
638
+ * data as needed.
639
+ *
640
+ * @param options The signup options (email, password, connection, etc.).
641
+ * @param storeOptions Optional options used to resolve the domain (resolver mode).
642
+ *
643
+ * @throws {SignUpError} If there was an issue signing the user up.
644
+ *
645
+ * @returns A promise resolving to the created user result with a normalized `id` field.
646
+ */
647
+ signUp(options: SignUpOptions, storeOptions?: TStoreOptions): Promise<SignUpResult>;
648
+ /**
649
+ * Requests a password-change email for a database connection user.
650
+ *
651
+ * Delegates to the underlying `AuthClient.database.changePassword` without any
652
+ * session state modification. The caller is responsible for informing the user
653
+ * of the sent email as needed.
654
+ *
655
+ * @param options The password change options (email, connection, organization, etc.).
656
+ * @param storeOptions Optional options used to resolve the domain (resolver mode).
657
+ *
658
+ * @throws {ChangePasswordError} If there was an issue requesting the password change.
659
+ *
660
+ * @returns A promise resolving to the server's plain-text confirmation message.
661
+ */
662
+ changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions): Promise<string>;
663
+ }
664
+
575
665
  declare class ServerClient<TStoreOptions = unknown> {
576
666
  #private;
577
667
  /**
@@ -609,12 +699,32 @@ declare class ServerClient<TStoreOptions = unknown> {
609
699
  * and `getToken()` so the credential is exchanged against the tenant that issued it.
610
700
  */
611
701
  get passkey(): ServerPasskeyClient<TStoreOptions>;
702
+ /**
703
+ * The database client for self-service sign-up and password-change requests
704
+ * against an Auth0 database connection.
705
+ *
706
+ * Provides `signUp()` to register a user and `changePassword()` to request a
707
+ * password-reset email. Both are pure passthrough operations to the Auth0
708
+ * Authentication API — they never read or write the session/state store.
709
+ *
710
+ * Like `passkey`, this property is available in both static and resolver
711
+ * (multi-tenant) domain modes. In resolver mode, pass `storeOptions` so the
712
+ * request resolves the intended tenant.
713
+ */
714
+ get database(): ServerDatabaseClient<TStoreOptions>;
612
715
  constructor(options: ServerClientOptions<TStoreOptions>);
613
716
  /**
614
717
  * Starts the interactive login process, and returns a URL to redirect the user-agent to to request authorization at Auth0.
718
+ *
719
+ * When `organization` is provided (per-login option, client-level default, or via
720
+ * `authorizationParams.organization`), it is forwarded to `/authorize` and remembered so the
721
+ * returned ID token's organization claim can be validated in `completeInteractiveLogin`.
722
+ *
615
723
  * @param options Optional options used to configure the interactive login process.
616
724
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
617
725
  *
726
+ * @throws {OrganizationValidationError} If the resolved `organization` is blank.
727
+ * @throws {InvalidConfigurationError} If `invitation` is provided without an `organization`.
618
728
  * @throws {BuildAuthorizationUrlError} If there was an issue when building the Authorization URL.
619
729
  *
620
730
  * @returns A promise resolving to a URL object, representing the URL to redirect the user-agent to to request authorization at Auth0.
@@ -628,6 +738,7 @@ declare class ServerClient<TStoreOptions = unknown> {
628
738
  *
629
739
  * @throws {MissingTransactionError} When no transaction was found.
630
740
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
741
+ * @throws {OrganizationValidationError} When an organization was requested at login and the returned ID token's organization claim is missing or does not match; nothing is persisted.
631
742
  * @throws {SessionExpiredError} When the ID token's `session_expiry` is already in the past at login (the session is born expired); nothing is persisted.
632
743
  *
633
744
  * @returns A promise resolving to an object, containing the original appState (if present) and the authorizationDetails (when RAR was used).
@@ -812,6 +923,22 @@ declare class ServerClient<TStoreOptions = unknown> {
812
923
  * @returns The Connection Token Set, containing the access token for the connection, as well as additional information.
813
924
  */
814
925
  getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions): Promise<ConnectionTokenSet>;
926
+ /**
927
+ * Revokes the refresh token stored in the current session, or an explicitly supplied token.
928
+ *
929
+ * In resolver mode, revocation only occurs when the session domain matches the domain resolved
930
+ * for the current request. If the domains differ (or the session has no stored domain), the call
931
+ * returns without revoking to avoid sending a token to the wrong tenant. This guard applies even
932
+ * when a token is passed explicitly via `options.token`.
933
+ *
934
+ * @param options Optionally supply a token to revoke instead of reading from the session.
935
+ * @param storeOptions Optional options passed to the StateStore.
936
+ *
937
+ * @throws {MissingRequiredArgumentError} If `options.token` is an empty string.
938
+ * @throws {MissingSessionError} If no refresh token is found in the session and none was provided.
939
+ * @throws {TokenRevocationError} If the revocation request fails.
940
+ */
941
+ revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions): Promise<void>;
815
942
  /**
816
943
  * Logs the user out and returns a URL to redirect the user-agent to after they log out.
817
944
  * @param options Options used to configure the logout process.
@@ -1053,4 +1180,4 @@ declare class SessionExpiredError extends Error {
1053
1180
  constructor(message?: string);
1054
1181
  }
1055
1182
 
1056
- export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type CompletePasswordlessEmailOptions, type CompletePasswordlessOptions, type CompletePasswordlessResult, type CompletePasswordlessSmsOptions, type ConnectionTokenSet, type CookieHandler, type CookieSerializeOptions, CookieTransactionStore, type CustomTokenExchangeOptions, type DomainResolver, type EncryptedStoreOptions, type GetAccessTokenOptions, type InternalStateData, InvalidConfigurationError, IssuerValidationError, type LoginBackchannelOptions, type LoginBackchannelResult, type LoginWithCustomTokenExchangeOptions, type LoginWithCustomTokenExchangeResult, type LogoutOptions, type LogoutTokenClaims, type MfaVerifyResponse, MissingRequiredArgumentError, MissingSessionError, MissingTransactionError, type PasskeyGetTokenResult, ServerClient, type ServerClientOptions, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
1183
+ export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type CompletePasswordlessEmailOptions, type CompletePasswordlessOptions, type CompletePasswordlessResult, type CompletePasswordlessSmsOptions, type ConnectionTokenSet, type CookieHandler, type CookieSerializeOptions, CookieTransactionStore, type CustomTokenExchangeOptions, type DomainResolver, type EncryptedStoreOptions, type GetAccessTokenOptions, type InternalStateData, InvalidConfigurationError, IssuerValidationError, type LoginBackchannelOptions, type LoginBackchannelResult, type LoginWithCustomTokenExchangeOptions, type LoginWithCustomTokenExchangeResult, type LogoutOptions, type LogoutTokenClaims, type MfaVerifyResponse, MissingRequiredArgumentError, MissingSessionError, MissingTransactionError, type PasskeyGetTokenResult, type RevokeRefreshTokenOptions, ServerClient, type ServerClientOptions, ServerDatabaseClient, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, TokenResponse } from '@auth0/auth0-auth-js';
2
- export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OrganizationValidationError, OtpEnrollmentResponse, PasskeyChallengeError, PasskeyLoginChallengeOptions as PasskeyChallengeOptions, PasskeyLoginChallengeResponse as PasskeyChallengeResponse, PasskeyCreationOptions, PasskeyCredentialResponse, PasskeyGetTokenError, GetTokenByPasskeyOptions as PasskeyGetTokenOptions, PasskeyRegisterError, PasskeySignupChallengeOptions as PasskeyRegisterOptions, PasskeySignupChallengeResponse as PasskeyRegisterResponse, PasskeyRequestOptions, TelemetryConfig, TokenExchangeError, TokenResponse, isMfaRequiredError } from '@auth0/auth0-auth-js';
1
+ import { AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, SignUpOptions, SignUpResult, ChangePasswordOptions, TokenResponse } from '@auth0/auth0-auth-js';
2
+ export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, ChangePasswordError, ChangePasswordOptions, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OrganizationValidationError, OtpEnrollmentResponse, PasskeyChallengeError, PasskeyLoginChallengeOptions as PasskeyChallengeOptions, PasskeyLoginChallengeResponse as PasskeyChallengeResponse, PasskeyCreationOptions, PasskeyCredentialResponse, PasskeyGetTokenError, GetTokenByPasskeyOptions as PasskeyGetTokenOptions, PasskeyRegisterError, PasskeySignupChallengeOptions as PasskeyRegisterOptions, PasskeySignupChallengeResponse as PasskeyRegisterResponse, PasskeyRequestOptions, SignUpError, SignUpOptions, SignUpResult, TelemetryConfig, TokenExchangeError, TokenResponse, TokenRevocationError, isMfaRequiredError } from '@auth0/auth0-auth-js';
3
3
  import { JWTPayload } from 'jose';
4
4
 
5
5
  /**
@@ -26,6 +26,12 @@ interface ServerClientOptions<TStoreOptions = unknown> {
26
26
  clientAssertionSigningKey?: string | CryptoKey;
27
27
  clientAssertionSigningAlg?: string;
28
28
  authorizationParams?: AuthorizationParameters;
29
+ /**
30
+ * Default organization for all interactive login flows from this client.
31
+ * Can be an organization ID (e.g. `org_abc123`) or an organization name (e.g. `acme-corp`).
32
+ * A per-login value in {@link StartInteractiveLoginOptions} overrides this.
33
+ */
34
+ organization?: string;
29
35
  discoveryCache?: DiscoveryCacheOptions;
30
36
  transactionIdentifier?: string;
31
37
  stateIdentifier?: string;
@@ -57,12 +63,19 @@ interface UserClaims {
57
63
  email?: string;
58
64
  email_verified?: boolean;
59
65
  org_id?: string;
66
+ org_name?: string;
60
67
  [key: string]: unknown;
61
68
  }
62
69
  interface AuthorizationParameters {
63
70
  scope?: string;
64
71
  audience?: string;
65
72
  redirect_uri?: string;
73
+ /**
74
+ * The organization to log the user into. Prefer the first-class `organization`
75
+ * option on {@link StartInteractiveLoginOptions} / {@link ServerClientOptions};
76
+ * this is supported for backwards compatibility.
77
+ */
78
+ organization?: string;
66
79
  [key: string]: unknown;
67
80
  }
68
81
  interface TokenSet {
@@ -112,6 +125,11 @@ interface TransactionData {
112
125
  */
113
126
  codeVerifier?: string;
114
127
  domain?: string;
128
+ /**
129
+ * The organization requested at login, carried across the redirect so the
130
+ * returned ID token's organization claim can be validated at callback.
131
+ */
132
+ organization?: string;
115
133
  [key: string]: unknown;
116
134
  }
117
135
  interface AbstractDataStore<TData, TStoreOptions = unknown> {
@@ -146,6 +164,18 @@ interface StartInteractiveLoginOptions<TAppState = unknown> {
146
164
  pushedAuthorizationRequests?: boolean;
147
165
  appState?: TAppState;
148
166
  authorizationParams?: AuthorizationParameters;
167
+ /**
168
+ * The organization to log the user into. Overrides the client-level
169
+ * `organization` default. Can be an organization ID (`org_abc123`) or name
170
+ * (`acme-corp`). Also passable via `authorizationParams.organization`.
171
+ */
172
+ organization?: string;
173
+ /**
174
+ * The organization invitation ticket, when handling an invitation-acceptance flow.
175
+ * Requires `organization` to be set (per-login, client-level default, or via
176
+ * `authorizationParams`); providing `invitation` without an organization throws.
177
+ */
178
+ invitation?: string;
149
179
  }
150
180
  interface LoginBackchannelOptions {
151
181
  bindingMessage: string;
@@ -300,6 +330,13 @@ interface GetAccessTokenOptions {
300
330
  */
301
331
  scope?: string;
302
332
  }
333
+ interface RevokeRefreshTokenOptions {
334
+ /**
335
+ * Explicitly provide a refresh token to revoke.
336
+ * If omitted, the token stored in the current session is used.
337
+ */
338
+ token?: string;
339
+ }
303
340
  interface LogoutOptions {
304
341
  returnTo: string;
305
342
  }
@@ -572,6 +609,59 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
572
609
  getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
573
610
  }
574
611
 
612
+ /**
613
+ * @internal
614
+ * Options for constructing a ServerDatabaseClient.
615
+ *
616
+ * Like the passkey client, the database client resolves the domain per call so
617
+ * it keeps working in resolver (multi-tenant) mode. It therefore receives the
618
+ * parent client's `resolveDomain` and `getAuthClient` helpers instead of a
619
+ * fixed domain/authClient. Unlike the MFA/passkey clients, it never touches the
620
+ * state store — signup and change-password write no session.
621
+ */
622
+ interface ServerDatabaseClientOptions<TStoreOptions = unknown> {
623
+ resolveDomain: (storeOptions?: TStoreOptions) => Promise<string>;
624
+ getAuthClient: (domain: string) => AuthClient;
625
+ }
626
+
627
+ declare class ServerDatabaseClient<TStoreOptions = unknown> {
628
+ #private;
629
+ /**
630
+ * @internal
631
+ */
632
+ constructor(options: ServerDatabaseClientOptions<TStoreOptions>);
633
+ /**
634
+ * Registers a new user in a database connection.
635
+ *
636
+ * Delegates to the underlying `AuthClient.database.signUp` without any session
637
+ * state modification. The caller is responsible for handling the returned user
638
+ * data as needed.
639
+ *
640
+ * @param options The signup options (email, password, connection, etc.).
641
+ * @param storeOptions Optional options used to resolve the domain (resolver mode).
642
+ *
643
+ * @throws {SignUpError} If there was an issue signing the user up.
644
+ *
645
+ * @returns A promise resolving to the created user result with a normalized `id` field.
646
+ */
647
+ signUp(options: SignUpOptions, storeOptions?: TStoreOptions): Promise<SignUpResult>;
648
+ /**
649
+ * Requests a password-change email for a database connection user.
650
+ *
651
+ * Delegates to the underlying `AuthClient.database.changePassword` without any
652
+ * session state modification. The caller is responsible for informing the user
653
+ * of the sent email as needed.
654
+ *
655
+ * @param options The password change options (email, connection, organization, etc.).
656
+ * @param storeOptions Optional options used to resolve the domain (resolver mode).
657
+ *
658
+ * @throws {ChangePasswordError} If there was an issue requesting the password change.
659
+ *
660
+ * @returns A promise resolving to the server's plain-text confirmation message.
661
+ */
662
+ changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions): Promise<string>;
663
+ }
664
+
575
665
  declare class ServerClient<TStoreOptions = unknown> {
576
666
  #private;
577
667
  /**
@@ -609,12 +699,32 @@ declare class ServerClient<TStoreOptions = unknown> {
609
699
  * and `getToken()` so the credential is exchanged against the tenant that issued it.
610
700
  */
611
701
  get passkey(): ServerPasskeyClient<TStoreOptions>;
702
+ /**
703
+ * The database client for self-service sign-up and password-change requests
704
+ * against an Auth0 database connection.
705
+ *
706
+ * Provides `signUp()` to register a user and `changePassword()` to request a
707
+ * password-reset email. Both are pure passthrough operations to the Auth0
708
+ * Authentication API — they never read or write the session/state store.
709
+ *
710
+ * Like `passkey`, this property is available in both static and resolver
711
+ * (multi-tenant) domain modes. In resolver mode, pass `storeOptions` so the
712
+ * request resolves the intended tenant.
713
+ */
714
+ get database(): ServerDatabaseClient<TStoreOptions>;
612
715
  constructor(options: ServerClientOptions<TStoreOptions>);
613
716
  /**
614
717
  * Starts the interactive login process, and returns a URL to redirect the user-agent to to request authorization at Auth0.
718
+ *
719
+ * When `organization` is provided (per-login option, client-level default, or via
720
+ * `authorizationParams.organization`), it is forwarded to `/authorize` and remembered so the
721
+ * returned ID token's organization claim can be validated in `completeInteractiveLogin`.
722
+ *
615
723
  * @param options Optional options used to configure the interactive login process.
616
724
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
617
725
  *
726
+ * @throws {OrganizationValidationError} If the resolved `organization` is blank.
727
+ * @throws {InvalidConfigurationError} If `invitation` is provided without an `organization`.
618
728
  * @throws {BuildAuthorizationUrlError} If there was an issue when building the Authorization URL.
619
729
  *
620
730
  * @returns A promise resolving to a URL object, representing the URL to redirect the user-agent to to request authorization at Auth0.
@@ -628,6 +738,7 @@ declare class ServerClient<TStoreOptions = unknown> {
628
738
  *
629
739
  * @throws {MissingTransactionError} When no transaction was found.
630
740
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
741
+ * @throws {OrganizationValidationError} When an organization was requested at login and the returned ID token's organization claim is missing or does not match; nothing is persisted.
631
742
  * @throws {SessionExpiredError} When the ID token's `session_expiry` is already in the past at login (the session is born expired); nothing is persisted.
632
743
  *
633
744
  * @returns A promise resolving to an object, containing the original appState (if present) and the authorizationDetails (when RAR was used).
@@ -812,6 +923,22 @@ declare class ServerClient<TStoreOptions = unknown> {
812
923
  * @returns The Connection Token Set, containing the access token for the connection, as well as additional information.
813
924
  */
814
925
  getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions): Promise<ConnectionTokenSet>;
926
+ /**
927
+ * Revokes the refresh token stored in the current session, or an explicitly supplied token.
928
+ *
929
+ * In resolver mode, revocation only occurs when the session domain matches the domain resolved
930
+ * for the current request. If the domains differ (or the session has no stored domain), the call
931
+ * returns without revoking to avoid sending a token to the wrong tenant. This guard applies even
932
+ * when a token is passed explicitly via `options.token`.
933
+ *
934
+ * @param options Optionally supply a token to revoke instead of reading from the session.
935
+ * @param storeOptions Optional options passed to the StateStore.
936
+ *
937
+ * @throws {MissingRequiredArgumentError} If `options.token` is an empty string.
938
+ * @throws {MissingSessionError} If no refresh token is found in the session and none was provided.
939
+ * @throws {TokenRevocationError} If the revocation request fails.
940
+ */
941
+ revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions): Promise<void>;
815
942
  /**
816
943
  * Logs the user out and returns a URL to redirect the user-agent to after they log out.
817
944
  * @param options Options used to configure the logout process.
@@ -1053,4 +1180,4 @@ declare class SessionExpiredError extends Error {
1053
1180
  constructor(message?: string);
1054
1181
  }
1055
1182
 
1056
- export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type CompletePasswordlessEmailOptions, type CompletePasswordlessOptions, type CompletePasswordlessResult, type CompletePasswordlessSmsOptions, type ConnectionTokenSet, type CookieHandler, type CookieSerializeOptions, CookieTransactionStore, type CustomTokenExchangeOptions, type DomainResolver, type EncryptedStoreOptions, type GetAccessTokenOptions, type InternalStateData, InvalidConfigurationError, IssuerValidationError, type LoginBackchannelOptions, type LoginBackchannelResult, type LoginWithCustomTokenExchangeOptions, type LoginWithCustomTokenExchangeResult, type LogoutOptions, type LogoutTokenClaims, type MfaVerifyResponse, MissingRequiredArgumentError, MissingSessionError, MissingTransactionError, type PasskeyGetTokenResult, ServerClient, type ServerClientOptions, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
1183
+ export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type CompletePasswordlessEmailOptions, type CompletePasswordlessOptions, type CompletePasswordlessResult, type CompletePasswordlessSmsOptions, type ConnectionTokenSet, type CookieHandler, type CookieSerializeOptions, CookieTransactionStore, type CustomTokenExchangeOptions, type DomainResolver, type EncryptedStoreOptions, type GetAccessTokenOptions, type InternalStateData, InvalidConfigurationError, IssuerValidationError, type LoginBackchannelOptions, type LoginBackchannelResult, type LoginWithCustomTokenExchangeOptions, type LoginWithCustomTokenExchangeResult, type LogoutOptions, type LogoutTokenClaims, type MfaVerifyResponse, MissingRequiredArgumentError, MissingSessionError, MissingTransactionError, type PasskeyGetTokenResult, type RevokeRefreshTokenOptions, ServerClient, type ServerClientOptions, ServerDatabaseClient, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };