@auth0/auth0-server-js 1.12.1 → 1.13.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 { ActClaim, 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, PasswordlessStartError, PasswordlessVerifyError, SignUpError, SignUpOptions, SignUpResult, TelemetryConfig, TokenExchangeError, TokenResponse, TokenRevocationError, isMfaRequiredError } from '@auth0/auth0-auth-js';
1
+ import { ActClaim, AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, RequestOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, SignUpOptions, SignUpResult, ChangePasswordOptions, ApiResponse, GetUserInfoOptions, UserInfoResponse, TokenResponse } from '@auth0/auth0-auth-js';
2
+ export { ActClaim, ApiResponse, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, ChangePasswordError, ChangePasswordOptions, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, FullResponseOption, GetUserInfoOptions, 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, PasswordlessStartError, PasswordlessVerifyError, RequestOptions, SignUpError, SignUpOptions, SignUpResult, TelemetryConfig, TokenExchangeError, TokenResponse, TokenRevocationError, UserInfoError, UserInfoResponse, isMfaRequiredError } from '@auth0/auth0-auth-js';
3
3
  import { JWTPayload } from 'jose';
4
4
 
5
5
  /**
@@ -624,7 +624,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
624
624
  * @returns Promise resolving to an array of enrolled authenticators
625
625
  * @throws {MfaListAuthenticatorsError} When the request fails
626
626
  */
627
- listAuthenticators(options: ListAuthenticatorsOptions): Promise<AuthenticatorResponse[]>;
627
+ listAuthenticators(options: ListAuthenticatorsOptions, requestOptions?: RequestOptions): Promise<AuthenticatorResponse[]>;
628
628
  /**
629
629
  * Enrolls a new MFA authenticator for the user.
630
630
  *
@@ -632,7 +632,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
632
632
  * @returns Promise resolving to enrollment response with authenticator details
633
633
  * @throws {MfaEnrollmentError} When enrollment fails
634
634
  */
635
- enrollAuthenticator(options: EnrollAuthenticatorOptions): Promise<EnrollmentResponse>;
635
+ enrollAuthenticator(options: EnrollAuthenticatorOptions, requestOptions?: RequestOptions): Promise<EnrollmentResponse>;
636
636
  /**
637
637
  * Initiates an MFA challenge for user verification.
638
638
  *
@@ -640,7 +640,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
640
640
  * @returns Promise resolving to challenge response with challenge details
641
641
  * @throws {MfaChallengeError} When the challenge fails
642
642
  */
643
- challengeAuthenticator(options: ChallengeOptions): Promise<ChallengeResponse>;
643
+ challengeAuthenticator(options: ChallengeOptions, requestOptions?: RequestOptions): Promise<ChallengeResponse>;
644
644
  /**
645
645
  * Verifies an MFA challenge and completes the authentication flow.
646
646
  *
@@ -653,7 +653,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
653
653
  * @returns The tokens returned by Auth0 after successful verification
654
654
  * @throws {MfaVerifyError} When verification fails (e.g. invalid token, wrong code)
655
655
  */
656
- verify(options: MfaVerifyOptions, storeOptions?: TStoreOptions): Promise<MfaVerifyResponse>;
656
+ verify(options: MfaVerifyOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<MfaVerifyResponse>;
657
657
  }
658
658
 
659
659
  /**
@@ -703,7 +703,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
703
703
  *
704
704
  * @returns A promise resolving to the signup challenge.
705
705
  */
706
- register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeySignupChallengeResponse>;
706
+ register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeySignupChallengeResponse>;
707
707
  /**
708
708
  * Requests a passkey login challenge for an existing user.
709
709
  *
@@ -724,7 +724,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
724
724
  *
725
725
  * @returns A promise resolving to the login challenge.
726
726
  */
727
- challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeyLoginChallengeResponse>;
727
+ challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyLoginChallengeResponse>;
728
728
  /**
729
729
  * Completes a passkey authentication flow (signup or login) by exchanging the
730
730
  * WebAuthn credential for tokens, and persists the resulting session.
@@ -745,7 +745,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
745
745
  *
746
746
  * @returns A promise resolving to an object containing the authorizationDetails (when RAR was used).
747
747
  */
748
- getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
748
+ getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyGetTokenResult>;
749
749
  }
750
750
 
751
751
  /**
@@ -783,7 +783,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
783
783
  *
784
784
  * @returns A promise resolving to the created user result with a normalized `id` field.
785
785
  */
786
- signUp(options: SignUpOptions, storeOptions?: TStoreOptions): Promise<SignUpResult>;
786
+ signUp(options: SignUpOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SignUpResult>;
787
787
  /**
788
788
  * Requests a password-change email for a database connection user.
789
789
  *
@@ -798,7 +798,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
798
798
  *
799
799
  * @returns A promise resolving to the server's plain-text confirmation message.
800
800
  */
801
- changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions): Promise<string>;
801
+ changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<string>;
802
802
  }
803
803
 
804
804
  declare class ServerClient<TStoreOptions = unknown> {
@@ -874,6 +874,7 @@ declare class ServerClient<TStoreOptions = unknown> {
874
874
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
875
875
  * @param url The URl from which the query params should be extracted to exchange for a token.
876
876
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
877
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
877
878
  *
878
879
  * @throws {MissingTransactionError} When no transaction was found.
879
880
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
@@ -881,8 +882,15 @@ declare class ServerClient<TStoreOptions = unknown> {
881
882
  * @throws {SessionExpiredError} When the ID token's `session_expiry` is already in the past at login (the session is born expired); nothing is persisted.
882
883
  *
883
884
  * @returns A promise resolving to an object, containing the original appState (if present) and the authorizationDetails (when RAR was used).
885
+ *
886
+ * @remarks
887
+ * This method does not support the `fullResponse` opt-in in v1. It accepts
888
+ * `url` and `storeOptions` with no intermediate options object; adding
889
+ * `fullResponse` would require a new options parameter and is deferred to
890
+ * a later revision.
891
+ * TODO(#<issue-number>): add fullResponse overload to completeInteractiveLogin in a future minor.
884
892
  */
885
- completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
893
+ completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
886
894
  appState?: TAppState;
887
895
  authorizationDetails?: AuthorizationDetails[];
888
896
  }>;
@@ -903,13 +911,14 @@ declare class ServerClient<TStoreOptions = unknown> {
903
911
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
904
912
  * @param url The URl from which the query params should be extracted to exchange for a token.
905
913
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
914
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
906
915
  *
907
916
  * @throws {MissingTransactionError} When no transaction was found.
908
917
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
909
918
  *
910
919
  * @returns A promise resolving to an object, containing the original appState (if present).
911
920
  */
912
- completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
921
+ completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
913
922
  appState: TAppState | undefined;
914
923
  }>;
915
924
  /**
@@ -929,13 +938,14 @@ declare class ServerClient<TStoreOptions = unknown> {
929
938
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
930
939
  * @param url The URl from which the query params should be extracted to exchange for a token.
931
940
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
941
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
932
942
  *
933
943
  * @throws {MissingTransactionError} When no transaction was found.
934
944
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
935
945
  *
936
946
  * @returns A promise resolving to an object, containing the original appState (if present).
937
947
  */
938
- completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
948
+ completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
939
949
  appState: TAppState | undefined;
940
950
  }>;
941
951
  /**
@@ -945,13 +955,17 @@ declare class ServerClient<TStoreOptions = unknown> {
945
955
  * @see https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow
946
956
  * @param options Options used to configure the backchannel login process.
947
957
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
958
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the backchannel authorize request and the token polling that follows it.
948
959
  *
949
960
  * @throws {BackchannelAuthenticationError} If there was an issue when doing backchannel authentication.
950
961
  * @throws {SessionExpiredError} When the ID token's `session_expiry` is already in the past at login (the session is born expired); nothing is persisted.
951
962
  *
952
963
  * @returns A promise resolving to an object, containing the authorizationDetails (when RAR was used).
953
964
  */
954
- loginBackchannel(options: LoginBackchannelOptions, storeOptions?: TStoreOptions): Promise<LoginBackchannelResult>;
965
+ loginBackchannel(options: LoginBackchannelOptions & {
966
+ fullResponse: true;
967
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<LoginBackchannelResult>>;
968
+ loginBackchannel(options: LoginBackchannelOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<LoginBackchannelResult>;
955
969
  /**
956
970
  * Starts a passwordless flow by sending a one-time code (OTP) or a magic link.
957
971
  *
@@ -973,6 +987,7 @@ declare class ServerClient<TStoreOptions = unknown> {
973
987
  *
974
988
  * @param options Discriminated start options.
975
989
  * @param storeOptions Optional options passed to the resolver / stores.
990
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the `/passwordless/start` request.
976
991
  *
977
992
  * @throws {PasswordlessStartError} If the request fails, or if a magic link is requested without a `redirectUri`.
978
993
  *
@@ -989,7 +1004,7 @@ declare class ServerClient<TStoreOptions = unknown> {
989
1004
  * redirectUri: 'https://app.example.com/auth/callback',
990
1005
  * });
991
1006
  */
992
- startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions): Promise<void>;
1007
+ startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
993
1008
  /**
994
1009
  * Completes a passwordless OTP login and persists the resulting session.
995
1010
  *
@@ -1003,6 +1018,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1003
1018
  *
1004
1019
  * @param options Discriminated completion options (`connection`, identifier, `verificationCode`).
1005
1020
  * @param storeOptions Optional options passed to the resolver / stores.
1021
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token request.
1006
1022
  *
1007
1023
  * @throws {PasswordlessVerifyError} If the code is invalid, expired, or rate-limited. When the
1008
1024
  * connection requires MFA, the server responds with `mfa_required`; narrow the thrown error
@@ -1010,7 +1026,10 @@ declare class ServerClient<TStoreOptions = unknown> {
1010
1026
  *
1011
1027
  * @returns A promise resolving to the authorizationDetails (when RAR was used).
1012
1028
  */
1013
- completePasswordless(options: CompletePasswordlessOptions, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
1029
+ completePasswordless(options: CompletePasswordlessOptions & {
1030
+ fullResponse: true;
1031
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<CompletePasswordlessResult>>;
1032
+ completePasswordless(options: CompletePasswordlessOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<CompletePasswordlessResult>;
1014
1033
  /**
1015
1034
  * Completes a passwordless magic-link login and persists the resulting session.
1016
1035
  *
@@ -1021,6 +1040,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1021
1040
  *
1022
1041
  * @param url The callback URL containing the authorization `code` and `state`.
1023
1042
  * @param storeOptions Optional options passed to the resolver / stores.
1043
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code exchange.
1024
1044
  *
1025
1045
  * @throws {MissingTransactionError} If no magic-link transaction was found.
1026
1046
  * @throws {PasswordlessVerifyError} If the returned `state` is missing or does not match.
@@ -1031,9 +1051,15 @@ declare class ServerClient<TStoreOptions = unknown> {
1031
1051
  * @example
1032
1052
  * const result = await serverClient.completePasswordlessMagicLink(callbackUrl, storeOptions);
1033
1053
  */
1034
- completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
1054
+ completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<CompletePasswordlessResult>;
1035
1055
  /**
1036
1056
  * Retrieves the user from the store, or undefined if no user found.
1057
+ *
1058
+ * This does not accept `RequestOptions`. It is a pure read from the state store and makes no
1059
+ * network call, so a per-request `signal`/`headers`/`customFetch` could not take effect. The
1060
+ * exclusion is deliberate: a parameter that can never do anything costs the public surface more
1061
+ * than the asymmetry with `getAccessToken`/`getAccessTokenForConnection`/`revokeRefreshToken` does.
1062
+ *
1037
1063
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1038
1064
  * @returns The user, or undefined if no user found in the store.
1039
1065
  */
@@ -1044,8 +1070,35 @@ declare class ServerClient<TStoreOptions = unknown> {
1044
1070
  * @returns The session or undefined if no session found in the store.
1045
1071
  */
1046
1072
  getSession(storeOptions?: TStoreOptions): Promise<SessionData | undefined>;
1073
+ /**
1074
+ * Retrieves the OIDC UserInfo claims for a given access token.
1075
+ *
1076
+ * The access token must be supplied explicitly by the caller. This method does NOT read
1077
+ * the token from the session and does NOT trigger a refresh. The token must be accepted by
1078
+ * the `/userinfo` endpoint:
1079
+ * - Without Multi-Resource Refresh Tokens (MRRT): pass a default OIDC access token, one
1080
+ * obtained without an explicit `audience` parameter.
1081
+ * - With MRRT: tokens are audience-bound, so request the userinfo endpoint as the audience
1082
+ * (e.g. `https://<domain>/userinfo`) when obtaining the token. A token bound to a
1083
+ * different resource-server audience is rejected by `/userinfo`.
1084
+ *
1085
+ * `/userinfo` is a bearer-protected resource and requires no client authentication, so this
1086
+ * works for public clients: the supplied access token is the only credential used.
1087
+ *
1088
+ * @param options Options containing the access token and an optional expected subject
1089
+ * for OIDC subject-consistency validation.
1090
+ * @param storeOptions Optional store options, used to resolve the domain in resolver mode.
1091
+ * @param requestOptions Optional per-request options (signal, headers, customFetch) forwarded
1092
+ * to the underlying `/userinfo` request.
1093
+ * @throws {UserInfoError} When the `/userinfo` request fails or the subject check fails.
1094
+ * @returns A Promise resolving to the UserInfo claims.
1095
+ */
1096
+ getUserInfo(options: GetUserInfoOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<UserInfoResponse>;
1097
+ getAccessToken(options: GetAccessTokenOptions & {
1098
+ fullResponse: true;
1099
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<TokenSet>>;
1047
1100
  getAccessToken(storeOptions?: TStoreOptions): Promise<TokenSet>;
1048
- getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions): Promise<TokenSet>;
1101
+ getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<TokenSet>;
1049
1102
  /**
1050
1103
  * Retrieves an access token for a connection.
1051
1104
  *
@@ -1056,12 +1109,16 @@ declare class ServerClient<TStoreOptions = unknown> {
1056
1109
  *
1057
1110
  * @param options - Options for retrieving an access token for a connection.
1058
1111
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1112
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). A cache hit returns before any network call, so `requestOptions` (including `signal`) is a no-op on that path; it applies only to the Token Vault exchange on a cache miss.
1059
1113
  *
1060
1114
  * @throws {TokenForConnectionError} If the refresh token was not found or there was an issue requesting the access token.
1061
1115
  *
1062
1116
  * @returns The Connection Token Set, containing the access token for the connection, as well as additional information.
1063
1117
  */
1064
- getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions): Promise<ConnectionTokenSet>;
1118
+ getAccessTokenForConnection(options: AccessTokenForConnectionOptions & {
1119
+ fullResponse: true;
1120
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<ConnectionTokenSet>>;
1121
+ getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ConnectionTokenSet>;
1065
1122
  /**
1066
1123
  * Revokes the refresh token stored in the current session, or an explicitly supplied token.
1067
1124
  *
@@ -1072,19 +1129,21 @@ declare class ServerClient<TStoreOptions = unknown> {
1072
1129
  *
1073
1130
  * @param options Optionally supply a token to revoke instead of reading from the session.
1074
1131
  * @param storeOptions Optional options passed to the StateStore.
1132
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the revocation request.
1075
1133
  *
1076
1134
  * @throws {MissingRequiredArgumentError} If `options.token` is an empty string.
1077
1135
  * @throws {MissingSessionError} If no refresh token is found in the session and none was provided.
1078
1136
  * @throws {TokenRevocationError} If the revocation request fails.
1079
1137
  */
1080
- revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions): Promise<void>;
1138
+ revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
1081
1139
  /**
1082
1140
  * Logs the user out and returns a URL to redirect the user-agent to after they log out.
1083
1141
  * @param options Options used to configure the logout process.
1084
1142
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1143
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token revocation ONLY. Building the logout URL is local string work and issues no request, so nothing here can affect it.
1085
1144
  * @returns {URL}
1086
1145
  */
1087
- logout(options: LogoutOptions, storeOptions?: TStoreOptions): Promise<URL>;
1146
+ logout(options: LogoutOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<URL>;
1088
1147
  /**
1089
1148
  * Exchanges a custom token for Auth0 tokens and persists the resulting session (RFC 8693).
1090
1149
  *
@@ -1098,13 +1157,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1098
1157
  *
1099
1158
  * @param options Options for the custom token exchange, including the subject token and its type.
1100
1159
  * @param storeOptions Optional options passed to the StateStore.
1160
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token exchange.
1101
1161
  *
1102
1162
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1103
1163
  * @throws {MissingClientAuthError} If client credentials are not configured.
1104
1164
  *
1105
1165
  * @returns A promise resolving to an object containing `authorizationDetails` when RAR was used.
1106
1166
  */
1107
- loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions, storeOptions?: TStoreOptions): Promise<LoginWithCustomTokenExchangeResult>;
1167
+ loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions & {
1168
+ fullResponse: true;
1169
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<LoginWithCustomTokenExchangeResult>>;
1170
+ loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<LoginWithCustomTokenExchangeResult>;
1108
1171
  /**
1109
1172
  * Exchanges a custom token for Auth0 tokens without establishing a session (RFC 8693).
1110
1173
  *
@@ -1117,13 +1180,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1117
1180
  *
1118
1181
  * @param options Options for the custom token exchange, including the subject token and its type.
1119
1182
  * @param storeOptions Optional options passed to the StateStore (used only for domain resolution in resolver mode).
1183
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token exchange.
1120
1184
  *
1121
1185
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1122
1186
  * @throws {MissingClientAuthError} If client credentials are not configured.
1123
1187
  *
1124
1188
  * @returns A promise resolving to the token response from Auth0.
1125
1189
  */
1126
- customTokenExchange(options: CustomTokenExchangeOptions, storeOptions?: TStoreOptions): Promise<TokenResponse>;
1190
+ customTokenExchange(options: CustomTokenExchangeOptions & {
1191
+ fullResponse: true;
1192
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<TokenResponse>>;
1193
+ customTokenExchange(options: CustomTokenExchangeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<TokenResponse>;
1127
1194
  /**
1128
1195
  * Requests a Session Transfer Token (STT) for impersonation via session transfer (RFC 8693).
1129
1196
  *
@@ -1146,8 +1213,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1146
1213
  * {@link ServerClient.buildSessionTransferRedirect}, which is forwarded to the target's
1147
1214
  * `/authorize` on the redirect.
1148
1215
  *
1216
+ * @remarks
1217
+ * If the actor's ID token has expired, an internal refresh is performed before the
1218
+ * session transfer token exchange. This refresh call is NOT guarded by the caller's
1219
+ * requestOptions.signal — if the signal fires during this step, the abort is ignored.
1220
+ * Only the final exchangeToken call respects the signal.
1221
+ * Thread requestOptions into #resolveSessionTransferActor in a future minor if
1222
+ * callers need full-request abort coverage.
1223
+ *
1149
1224
  * @param options Options including the developer-supplied `subjectToken`/`subjectTokenType` and an optional explicit `actor`.
1150
1225
  * @param storeOptions Optional options used to read the agent session (for the actor) and resolve the request domain.
1226
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the STT exchange only. Resolving the actor may refresh an expired agent session ID token, and that refresh is an internal call outside the caller's per-request scope, so it does not receive these options.
1151
1227
  *
1152
1228
  * @throws {TokenExchangeError} With code `actor_unavailable` when no explicit actor is given and no usable session ID token can be resolved — no logged-in agent, a session that belongs to a different domain in resolver mode, or an expired ID token that cannot be refreshed (raised client-side, before any network call). With the default code when the exchange itself fails; a server-side `setactor_required` or `session_transfer_disabled` condition is surfaced via `cause.error` / `cause.error_description`. An organization the tenant rejects also surfaces here.
1153
1229
  * @throws {MissingClientAuthError} When client credentials are not configured (STT requires a confidential client).
@@ -1156,7 +1232,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1156
1232
  *
1157
1233
  * @returns A promise resolving to a {@link SessionTransferTokenResult} containing the STT and its metadata.
1158
1234
  */
1159
- requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions): Promise<SessionTransferTokenResult>;
1235
+ requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SessionTransferTokenResult>;
1160
1236
  /**
1161
1237
  * Builds the redirect URL that hands a Session Transfer Token (STT) to the target app's login URL.
1162
1238
  *
@@ -1182,6 +1258,11 @@ declare class ServerClient<TStoreOptions = unknown> {
1182
1258
  buildSessionTransferRedirect(targetLoginUrl: string, result: SessionTransferTokenResult, options?: BuildSessionTransferRedirectOptions): URL;
1183
1259
  /**
1184
1260
  * Handles the backchannel logout process by verifying the logout token and deleting the session from the store if the logout token was considered valid.
1261
+ *
1262
+ * This does not accept `RequestOptions`. Verification does fetch JWKS, but the auth-js method it
1263
+ * delegates to, `verifyLogoutToken`, takes no `requestOptions`, so there is nothing to forward.
1264
+ * That fetch always uses the client's configured `customFetch`.
1265
+ *
1185
1266
  * @param logoutToken The logout token to verify and use to delete the session from the store.
1186
1267
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1187
1268
  *