@auth0/auth0-server-js 1.12.0 → 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
  /**
@@ -690,6 +690,12 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
690
690
  *
691
691
  * This method does not create a session; no state is persisted.
692
692
  *
693
+ * On a confidential client this endpoint accepts `client_secret` as its only
694
+ * credential, so configure `clientSecret` on the `ServerClient`. It does not
695
+ * accept a private key JWT and is not served on the mTLS endpoint aliases, so a
696
+ * client configured with only `clientAssertionSigningKey` or only `useMtls` is
697
+ * rejected by Auth0. Public clients authenticate with `clientId` alone.
698
+ *
693
699
  * @param options User profile data and optional realm/organization.
694
700
  * @param storeOptions Optional options used to resolve the domain (resolver mode).
695
701
  *
@@ -697,7 +703,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
697
703
  *
698
704
  * @returns A promise resolving to the signup challenge.
699
705
  */
700
- register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeySignupChallengeResponse>;
706
+ register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeySignupChallengeResponse>;
701
707
  /**
702
708
  * Requests a passkey login challenge for an existing user.
703
709
  *
@@ -708,6 +714,9 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
708
714
  *
709
715
  * This method does not create a session; no state is persisted.
710
716
  *
717
+ * Client authentication works the same way as {@link ServerPasskeyClient.register}:
718
+ * on a confidential client, only a `clientSecret` is accepted here.
719
+ *
711
720
  * @param options Optional realm/organization configuration.
712
721
  * @param storeOptions Optional options used to resolve the domain (resolver mode).
713
722
  *
@@ -715,7 +724,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
715
724
  *
716
725
  * @returns A promise resolving to the login challenge.
717
726
  */
718
- challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeyLoginChallengeResponse>;
727
+ challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyLoginChallengeResponse>;
719
728
  /**
720
729
  * Completes a passkey authentication flow (signup or login) by exchanging the
721
730
  * WebAuthn credential for tokens, and persists the resulting session.
@@ -736,7 +745,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
736
745
  *
737
746
  * @returns A promise resolving to an object containing the authorizationDetails (when RAR was used).
738
747
  */
739
- getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
748
+ getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyGetTokenResult>;
740
749
  }
741
750
 
742
751
  /**
@@ -774,7 +783,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
774
783
  *
775
784
  * @returns A promise resolving to the created user result with a normalized `id` field.
776
785
  */
777
- signUp(options: SignUpOptions, storeOptions?: TStoreOptions): Promise<SignUpResult>;
786
+ signUp(options: SignUpOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SignUpResult>;
778
787
  /**
779
788
  * Requests a password-change email for a database connection user.
780
789
  *
@@ -789,7 +798,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
789
798
  *
790
799
  * @returns A promise resolving to the server's plain-text confirmation message.
791
800
  */
792
- changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions): Promise<string>;
801
+ changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<string>;
793
802
  }
794
803
 
795
804
  declare class ServerClient<TStoreOptions = unknown> {
@@ -865,6 +874,7 @@ declare class ServerClient<TStoreOptions = unknown> {
865
874
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
866
875
  * @param url The URl from which the query params should be extracted to exchange for a token.
867
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.
868
878
  *
869
879
  * @throws {MissingTransactionError} When no transaction was found.
870
880
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
@@ -872,8 +882,15 @@ declare class ServerClient<TStoreOptions = unknown> {
872
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.
873
883
  *
874
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.
875
892
  */
876
- completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
893
+ completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
877
894
  appState?: TAppState;
878
895
  authorizationDetails?: AuthorizationDetails[];
879
896
  }>;
@@ -894,13 +911,14 @@ declare class ServerClient<TStoreOptions = unknown> {
894
911
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
895
912
  * @param url The URl from which the query params should be extracted to exchange for a token.
896
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.
897
915
  *
898
916
  * @throws {MissingTransactionError} When no transaction was found.
899
917
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
900
918
  *
901
919
  * @returns A promise resolving to an object, containing the original appState (if present).
902
920
  */
903
- completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
921
+ completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
904
922
  appState: TAppState | undefined;
905
923
  }>;
906
924
  /**
@@ -920,13 +938,14 @@ declare class ServerClient<TStoreOptions = unknown> {
920
938
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
921
939
  * @param url The URl from which the query params should be extracted to exchange for a token.
922
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.
923
942
  *
924
943
  * @throws {MissingTransactionError} When no transaction was found.
925
944
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
926
945
  *
927
946
  * @returns A promise resolving to an object, containing the original appState (if present).
928
947
  */
929
- completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
948
+ completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
930
949
  appState: TAppState | undefined;
931
950
  }>;
932
951
  /**
@@ -936,13 +955,17 @@ declare class ServerClient<TStoreOptions = unknown> {
936
955
  * @see https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow
937
956
  * @param options Options used to configure the backchannel login process.
938
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.
939
959
  *
940
960
  * @throws {BackchannelAuthenticationError} If there was an issue when doing backchannel authentication.
941
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.
942
962
  *
943
963
  * @returns A promise resolving to an object, containing the authorizationDetails (when RAR was used).
944
964
  */
945
- 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>;
946
969
  /**
947
970
  * Starts a passwordless flow by sending a one-time code (OTP) or a magic link.
948
971
  *
@@ -964,6 +987,7 @@ declare class ServerClient<TStoreOptions = unknown> {
964
987
  *
965
988
  * @param options Discriminated start options.
966
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.
967
991
  *
968
992
  * @throws {PasswordlessStartError} If the request fails, or if a magic link is requested without a `redirectUri`.
969
993
  *
@@ -980,7 +1004,7 @@ declare class ServerClient<TStoreOptions = unknown> {
980
1004
  * redirectUri: 'https://app.example.com/auth/callback',
981
1005
  * });
982
1006
  */
983
- startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions): Promise<void>;
1007
+ startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
984
1008
  /**
985
1009
  * Completes a passwordless OTP login and persists the resulting session.
986
1010
  *
@@ -994,6 +1018,7 @@ declare class ServerClient<TStoreOptions = unknown> {
994
1018
  *
995
1019
  * @param options Discriminated completion options (`connection`, identifier, `verificationCode`).
996
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.
997
1022
  *
998
1023
  * @throws {PasswordlessVerifyError} If the code is invalid, expired, or rate-limited. When the
999
1024
  * connection requires MFA, the server responds with `mfa_required`; narrow the thrown error
@@ -1001,7 +1026,10 @@ declare class ServerClient<TStoreOptions = unknown> {
1001
1026
  *
1002
1027
  * @returns A promise resolving to the authorizationDetails (when RAR was used).
1003
1028
  */
1004
- 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>;
1005
1033
  /**
1006
1034
  * Completes a passwordless magic-link login and persists the resulting session.
1007
1035
  *
@@ -1012,6 +1040,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1012
1040
  *
1013
1041
  * @param url The callback URL containing the authorization `code` and `state`.
1014
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.
1015
1044
  *
1016
1045
  * @throws {MissingTransactionError} If no magic-link transaction was found.
1017
1046
  * @throws {PasswordlessVerifyError} If the returned `state` is missing or does not match.
@@ -1022,9 +1051,15 @@ declare class ServerClient<TStoreOptions = unknown> {
1022
1051
  * @example
1023
1052
  * const result = await serverClient.completePasswordlessMagicLink(callbackUrl, storeOptions);
1024
1053
  */
1025
- completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
1054
+ completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<CompletePasswordlessResult>;
1026
1055
  /**
1027
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
+ *
1028
1063
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1029
1064
  * @returns The user, or undefined if no user found in the store.
1030
1065
  */
@@ -1035,8 +1070,35 @@ declare class ServerClient<TStoreOptions = unknown> {
1035
1070
  * @returns The session or undefined if no session found in the store.
1036
1071
  */
1037
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>>;
1038
1100
  getAccessToken(storeOptions?: TStoreOptions): Promise<TokenSet>;
1039
- getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions): Promise<TokenSet>;
1101
+ getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<TokenSet>;
1040
1102
  /**
1041
1103
  * Retrieves an access token for a connection.
1042
1104
  *
@@ -1047,12 +1109,16 @@ declare class ServerClient<TStoreOptions = unknown> {
1047
1109
  *
1048
1110
  * @param options - Options for retrieving an access token for a connection.
1049
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.
1050
1113
  *
1051
1114
  * @throws {TokenForConnectionError} If the refresh token was not found or there was an issue requesting the access token.
1052
1115
  *
1053
1116
  * @returns The Connection Token Set, containing the access token for the connection, as well as additional information.
1054
1117
  */
1055
- 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>;
1056
1122
  /**
1057
1123
  * Revokes the refresh token stored in the current session, or an explicitly supplied token.
1058
1124
  *
@@ -1063,19 +1129,21 @@ declare class ServerClient<TStoreOptions = unknown> {
1063
1129
  *
1064
1130
  * @param options Optionally supply a token to revoke instead of reading from the session.
1065
1131
  * @param storeOptions Optional options passed to the StateStore.
1132
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the revocation request.
1066
1133
  *
1067
1134
  * @throws {MissingRequiredArgumentError} If `options.token` is an empty string.
1068
1135
  * @throws {MissingSessionError} If no refresh token is found in the session and none was provided.
1069
1136
  * @throws {TokenRevocationError} If the revocation request fails.
1070
1137
  */
1071
- revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions): Promise<void>;
1138
+ revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
1072
1139
  /**
1073
1140
  * Logs the user out and returns a URL to redirect the user-agent to after they log out.
1074
1141
  * @param options Options used to configure the logout process.
1075
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.
1076
1144
  * @returns {URL}
1077
1145
  */
1078
- logout(options: LogoutOptions, storeOptions?: TStoreOptions): Promise<URL>;
1146
+ logout(options: LogoutOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<URL>;
1079
1147
  /**
1080
1148
  * Exchanges a custom token for Auth0 tokens and persists the resulting session (RFC 8693).
1081
1149
  *
@@ -1089,13 +1157,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1089
1157
  *
1090
1158
  * @param options Options for the custom token exchange, including the subject token and its type.
1091
1159
  * @param storeOptions Optional options passed to the StateStore.
1160
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token exchange.
1092
1161
  *
1093
1162
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1094
1163
  * @throws {MissingClientAuthError} If client credentials are not configured.
1095
1164
  *
1096
1165
  * @returns A promise resolving to an object containing `authorizationDetails` when RAR was used.
1097
1166
  */
1098
- 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>;
1099
1171
  /**
1100
1172
  * Exchanges a custom token for Auth0 tokens without establishing a session (RFC 8693).
1101
1173
  *
@@ -1108,13 +1180,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1108
1180
  *
1109
1181
  * @param options Options for the custom token exchange, including the subject token and its type.
1110
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.
1111
1184
  *
1112
1185
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1113
1186
  * @throws {MissingClientAuthError} If client credentials are not configured.
1114
1187
  *
1115
1188
  * @returns A promise resolving to the token response from Auth0.
1116
1189
  */
1117
- 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>;
1118
1194
  /**
1119
1195
  * Requests a Session Transfer Token (STT) for impersonation via session transfer (RFC 8693).
1120
1196
  *
@@ -1137,8 +1213,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1137
1213
  * {@link ServerClient.buildSessionTransferRedirect}, which is forwarded to the target's
1138
1214
  * `/authorize` on the redirect.
1139
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
+ *
1140
1224
  * @param options Options including the developer-supplied `subjectToken`/`subjectTokenType` and an optional explicit `actor`.
1141
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.
1142
1227
  *
1143
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.
1144
1229
  * @throws {MissingClientAuthError} When client credentials are not configured (STT requires a confidential client).
@@ -1147,7 +1232,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1147
1232
  *
1148
1233
  * @returns A promise resolving to a {@link SessionTransferTokenResult} containing the STT and its metadata.
1149
1234
  */
1150
- requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions): Promise<SessionTransferTokenResult>;
1235
+ requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SessionTransferTokenResult>;
1151
1236
  /**
1152
1237
  * Builds the redirect URL that hands a Session Transfer Token (STT) to the target app's login URL.
1153
1238
  *
@@ -1173,6 +1258,11 @@ declare class ServerClient<TStoreOptions = unknown> {
1173
1258
  buildSessionTransferRedirect(targetLoginUrl: string, result: SessionTransferTokenResult, options?: BuildSessionTransferRedirectOptions): URL;
1174
1259
  /**
1175
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
+ *
1176
1266
  * @param logoutToken The logout token to verify and use to delete the session from the store.
1177
1267
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1178
1268
  *