@auth0/auth0-server-js 1.12.1 → 1.14.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.ts 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, EnterpriseConnectNotSupportedError, FullResponseOption, GetUserInfoOptions, IsFederatedDomainOptions, 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, isFederatedDomain, isMfaRequiredError } from '@auth0/auth0-auth-js';
3
3
  import { JWTPayload } from 'jose';
4
4
 
5
5
  /**
@@ -40,7 +40,11 @@ interface ServerClientOptions<TStoreOptions = unknown> {
40
40
  */
41
41
  customFetch?: typeof fetch;
42
42
  transactionStore: TransactionStore<TStoreOptions>;
43
- stateStore: StateStore<TStoreOptions>;
43
+ /**
44
+ * The state store for persisting session state. Required for non-Enterprise Connect mode.
45
+ * When `enterpriseConnect: true`, the state store is not needed (Auth0 does not manage a session).
46
+ */
47
+ stateStore?: StateStore<TStoreOptions>;
44
48
  /**
45
49
  * Indicates whether the SDK should use the mTLS endpoints if they are available.
46
50
  *
@@ -52,6 +56,15 @@ interface ServerClientOptions<TStoreOptions = unknown> {
52
56
  * Telemetry is enabled by default and sends the Auth0-Client header with package name and version.
53
57
  */
54
58
  telemetry?: TelemetryConfig;
59
+ /**
60
+ * Set to true when using Enterprise Connect.
61
+ *
62
+ * Auth0 acts as a pure SSO relay — it authenticates the user via the enterprise
63
+ * IdP and hands back an ID token, but holds no session and issues no refresh
64
+ * tokens. Any method that depends on an Auth0-managed session or refresh token
65
+ * throws a clear error instead of returning null silently.
66
+ */
67
+ enterpriseConnect?: true;
55
68
  }
56
69
  interface UserClaims {
57
70
  sub: string;
@@ -345,6 +358,22 @@ interface RevokeRefreshTokenOptions {
345
358
  }
346
359
  interface LogoutOptions {
347
360
  returnTo: string;
361
+ /**
362
+ * When true, terminates the upstream identity provider session via federated logout.
363
+ * Required for Enterprise Connect to end the enterprise IdP session.
364
+ */
365
+ federated?: boolean;
366
+ }
367
+ interface StartEnterpriseLoginOptions {
368
+ /**
369
+ * The user's email address. The domain part is used for WebFinger discovery
370
+ * and the full email is forwarded as `login_hint` to Auth0's /authorize.
371
+ */
372
+ email: string;
373
+ /**
374
+ * The URL to redirect to after login completes.
375
+ */
376
+ returnTo?: string;
348
377
  }
349
378
  interface StartLinkUserOptions<TAppState = unknown> {
350
379
  connection: string;
@@ -624,7 +653,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
624
653
  * @returns Promise resolving to an array of enrolled authenticators
625
654
  * @throws {MfaListAuthenticatorsError} When the request fails
626
655
  */
627
- listAuthenticators(options: ListAuthenticatorsOptions): Promise<AuthenticatorResponse[]>;
656
+ listAuthenticators(options: ListAuthenticatorsOptions, requestOptions?: RequestOptions): Promise<AuthenticatorResponse[]>;
628
657
  /**
629
658
  * Enrolls a new MFA authenticator for the user.
630
659
  *
@@ -632,7 +661,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
632
661
  * @returns Promise resolving to enrollment response with authenticator details
633
662
  * @throws {MfaEnrollmentError} When enrollment fails
634
663
  */
635
- enrollAuthenticator(options: EnrollAuthenticatorOptions): Promise<EnrollmentResponse>;
664
+ enrollAuthenticator(options: EnrollAuthenticatorOptions, requestOptions?: RequestOptions): Promise<EnrollmentResponse>;
636
665
  /**
637
666
  * Initiates an MFA challenge for user verification.
638
667
  *
@@ -640,7 +669,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
640
669
  * @returns Promise resolving to challenge response with challenge details
641
670
  * @throws {MfaChallengeError} When the challenge fails
642
671
  */
643
- challengeAuthenticator(options: ChallengeOptions): Promise<ChallengeResponse>;
672
+ challengeAuthenticator(options: ChallengeOptions, requestOptions?: RequestOptions): Promise<ChallengeResponse>;
644
673
  /**
645
674
  * Verifies an MFA challenge and completes the authentication flow.
646
675
  *
@@ -653,7 +682,7 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
653
682
  * @returns The tokens returned by Auth0 after successful verification
654
683
  * @throws {MfaVerifyError} When verification fails (e.g. invalid token, wrong code)
655
684
  */
656
- verify(options: MfaVerifyOptions, storeOptions?: TStoreOptions): Promise<MfaVerifyResponse>;
685
+ verify(options: MfaVerifyOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<MfaVerifyResponse>;
657
686
  }
658
687
 
659
688
  /**
@@ -703,7 +732,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
703
732
  *
704
733
  * @returns A promise resolving to the signup challenge.
705
734
  */
706
- register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeySignupChallengeResponse>;
735
+ register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeySignupChallengeResponse>;
707
736
  /**
708
737
  * Requests a passkey login challenge for an existing user.
709
738
  *
@@ -724,7 +753,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
724
753
  *
725
754
  * @returns A promise resolving to the login challenge.
726
755
  */
727
- challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeyLoginChallengeResponse>;
756
+ challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyLoginChallengeResponse>;
728
757
  /**
729
758
  * Completes a passkey authentication flow (signup or login) by exchanging the
730
759
  * WebAuthn credential for tokens, and persists the resulting session.
@@ -745,7 +774,7 @@ declare class ServerPasskeyClient<TStoreOptions = unknown> {
745
774
  *
746
775
  * @returns A promise resolving to an object containing the authorizationDetails (when RAR was used).
747
776
  */
748
- getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
777
+ getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<PasskeyGetTokenResult>;
749
778
  }
750
779
 
751
780
  /**
@@ -783,7 +812,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
783
812
  *
784
813
  * @returns A promise resolving to the created user result with a normalized `id` field.
785
814
  */
786
- signUp(options: SignUpOptions, storeOptions?: TStoreOptions): Promise<SignUpResult>;
815
+ signUp(options: SignUpOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SignUpResult>;
787
816
  /**
788
817
  * Requests a password-change email for a database connection user.
789
818
  *
@@ -798,7 +827,7 @@ declare class ServerDatabaseClient<TStoreOptions = unknown> {
798
827
  *
799
828
  * @returns A promise resolving to the server's plain-text confirmation message.
800
829
  */
801
- changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions): Promise<string>;
830
+ changePassword(options: ChangePasswordOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<string>;
802
831
  }
803
832
 
804
833
  declare class ServerClient<TStoreOptions = unknown> {
@@ -852,6 +881,16 @@ declare class ServerClient<TStoreOptions = unknown> {
852
881
  */
853
882
  get database(): ServerDatabaseClient<TStoreOptions>;
854
883
  constructor(options: ServerClientOptions<TStoreOptions>);
884
+ /**
885
+ * Starts the Enterprise Connect login flow. Performs WebFinger domain discovery
886
+ * and, if the email domain is federated, initiates an interactive login with `login_hint`.
887
+ *
888
+ * @param options Options including the user's email and optional returnTo URL.
889
+ * @param storeOptions Optional options passed to the Transaction Store.
890
+ *
891
+ * @returns A URL to redirect to (federated domain) or null (not federated / invalid email).
892
+ */
893
+ startEnterpriseLogin(options: StartEnterpriseLoginOptions, storeOptions?: TStoreOptions): Promise<URL | null>;
855
894
  /**
856
895
  * Starts the interactive login process, and returns a URL to redirect the user-agent to to request authorization at Auth0.
857
896
  *
@@ -874,6 +913,7 @@ declare class ServerClient<TStoreOptions = unknown> {
874
913
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
875
914
  * @param url The URl from which the query params should be extracted to exchange for a token.
876
915
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
916
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
877
917
  *
878
918
  * @throws {MissingTransactionError} When no transaction was found.
879
919
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
@@ -881,10 +921,20 @@ declare class ServerClient<TStoreOptions = unknown> {
881
921
  * @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
922
  *
883
923
  * @returns A promise resolving to an object, containing the original appState (if present) and the authorizationDetails (when RAR was used).
924
+ * In Enterprise Connect mode, also includes `idTokenClaims` and `user`.
925
+ *
926
+ * @remarks
927
+ * This method does not support the `fullResponse` opt-in in v1. It accepts
928
+ * `url` and `storeOptions` with no intermediate options object; adding
929
+ * `fullResponse` would require a new options parameter and is deferred to
930
+ * a later revision.
931
+ * TODO(#<issue-number>): add fullResponse overload to completeInteractiveLogin in a future minor.
884
932
  */
885
- completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
933
+ completeInteractiveLogin<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
886
934
  appState?: TAppState;
887
935
  authorizationDetails?: AuthorizationDetails[];
936
+ idTokenClaims?: Record<string, unknown>;
937
+ user?: UserClaims;
888
938
  }>;
889
939
  /**
890
940
  * Starts the user linking process, and returns a URL to redirect the user-agent to to request authorization at Auth0.
@@ -903,13 +953,14 @@ declare class ServerClient<TStoreOptions = unknown> {
903
953
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
904
954
  * @param url The URl from which the query params should be extracted to exchange for a token.
905
955
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
956
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
906
957
  *
907
958
  * @throws {MissingTransactionError} When no transaction was found.
908
959
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
909
960
  *
910
961
  * @returns A promise resolving to an object, containing the original appState (if present).
911
962
  */
912
- completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
963
+ completeLinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
913
964
  appState: TAppState | undefined;
914
965
  }>;
915
966
  /**
@@ -929,13 +980,14 @@ declare class ServerClient<TStoreOptions = unknown> {
929
980
  * Takes an URL, extract the Authorization Code flow query parameters and requests a token.
930
981
  * @param url The URl from which the query params should be extracted to exchange for a token.
931
982
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
983
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code-for-token exchange.
932
984
  *
933
985
  * @throws {MissingTransactionError} When no transaction was found.
934
986
  * @throws {TokenByCodeError} If there was an issue requesting the access token.
935
987
  *
936
988
  * @returns A promise resolving to an object, containing the original appState (if present).
937
989
  */
938
- completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions): Promise<{
990
+ completeUnlinkUser<TAppState = unknown>(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<{
939
991
  appState: TAppState | undefined;
940
992
  }>;
941
993
  /**
@@ -945,13 +997,17 @@ declare class ServerClient<TStoreOptions = unknown> {
945
997
  * @see https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow
946
998
  * @param options Options used to configure the backchannel login process.
947
999
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1000
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the backchannel authorize request and the token polling that follows it.
948
1001
  *
949
1002
  * @throws {BackchannelAuthenticationError} If there was an issue when doing backchannel authentication.
950
1003
  * @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
1004
  *
952
1005
  * @returns A promise resolving to an object, containing the authorizationDetails (when RAR was used).
953
1006
  */
954
- loginBackchannel(options: LoginBackchannelOptions, storeOptions?: TStoreOptions): Promise<LoginBackchannelResult>;
1007
+ loginBackchannel(options: LoginBackchannelOptions & {
1008
+ fullResponse: true;
1009
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<LoginBackchannelResult>>;
1010
+ loginBackchannel(options: LoginBackchannelOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<LoginBackchannelResult>;
955
1011
  /**
956
1012
  * Starts a passwordless flow by sending a one-time code (OTP) or a magic link.
957
1013
  *
@@ -973,6 +1029,7 @@ declare class ServerClient<TStoreOptions = unknown> {
973
1029
  *
974
1030
  * @param options Discriminated start options.
975
1031
  * @param storeOptions Optional options passed to the resolver / stores.
1032
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the `/passwordless/start` request.
976
1033
  *
977
1034
  * @throws {PasswordlessStartError} If the request fails, or if a magic link is requested without a `redirectUri`.
978
1035
  *
@@ -989,7 +1046,7 @@ declare class ServerClient<TStoreOptions = unknown> {
989
1046
  * redirectUri: 'https://app.example.com/auth/callback',
990
1047
  * });
991
1048
  */
992
- startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions): Promise<void>;
1049
+ startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
993
1050
  /**
994
1051
  * Completes a passwordless OTP login and persists the resulting session.
995
1052
  *
@@ -1003,6 +1060,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1003
1060
  *
1004
1061
  * @param options Discriminated completion options (`connection`, identifier, `verificationCode`).
1005
1062
  * @param storeOptions Optional options passed to the resolver / stores.
1063
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token request.
1006
1064
  *
1007
1065
  * @throws {PasswordlessVerifyError} If the code is invalid, expired, or rate-limited. When the
1008
1066
  * connection requires MFA, the server responds with `mfa_required`; narrow the thrown error
@@ -1010,7 +1068,10 @@ declare class ServerClient<TStoreOptions = unknown> {
1010
1068
  *
1011
1069
  * @returns A promise resolving to the authorizationDetails (when RAR was used).
1012
1070
  */
1013
- completePasswordless(options: CompletePasswordlessOptions, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
1071
+ completePasswordless(options: CompletePasswordlessOptions & {
1072
+ fullResponse: true;
1073
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<CompletePasswordlessResult>>;
1074
+ completePasswordless(options: CompletePasswordlessOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<CompletePasswordlessResult>;
1014
1075
  /**
1015
1076
  * Completes a passwordless magic-link login and persists the resulting session.
1016
1077
  *
@@ -1021,6 +1082,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1021
1082
  *
1022
1083
  * @param url The callback URL containing the authorization `code` and `state`.
1023
1084
  * @param storeOptions Optional options passed to the resolver / stores.
1085
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the code exchange.
1024
1086
  *
1025
1087
  * @throws {MissingTransactionError} If no magic-link transaction was found.
1026
1088
  * @throws {PasswordlessVerifyError} If the returned `state` is missing or does not match.
@@ -1031,9 +1093,15 @@ declare class ServerClient<TStoreOptions = unknown> {
1031
1093
  * @example
1032
1094
  * const result = await serverClient.completePasswordlessMagicLink(callbackUrl, storeOptions);
1033
1095
  */
1034
- completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
1096
+ completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<CompletePasswordlessResult>;
1035
1097
  /**
1036
1098
  * Retrieves the user from the store, or undefined if no user found.
1099
+ *
1100
+ * This does not accept `RequestOptions`. It is a pure read from the state store and makes no
1101
+ * network call, so a per-request `signal`/`headers`/`customFetch` could not take effect. The
1102
+ * exclusion is deliberate: a parameter that can never do anything costs the public surface more
1103
+ * than the asymmetry with `getAccessToken`/`getAccessTokenForConnection`/`revokeRefreshToken` does.
1104
+ *
1037
1105
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1038
1106
  * @returns The user, or undefined if no user found in the store.
1039
1107
  */
@@ -1044,8 +1112,35 @@ declare class ServerClient<TStoreOptions = unknown> {
1044
1112
  * @returns The session or undefined if no session found in the store.
1045
1113
  */
1046
1114
  getSession(storeOptions?: TStoreOptions): Promise<SessionData | undefined>;
1115
+ /**
1116
+ * Retrieves the OIDC UserInfo claims for a given access token.
1117
+ *
1118
+ * The access token must be supplied explicitly by the caller. This method does NOT read
1119
+ * the token from the session and does NOT trigger a refresh. The token must be accepted by
1120
+ * the `/userinfo` endpoint:
1121
+ * - Without Multi-Resource Refresh Tokens (MRRT): pass a default OIDC access token, one
1122
+ * obtained without an explicit `audience` parameter.
1123
+ * - With MRRT: tokens are audience-bound, so request the userinfo endpoint as the audience
1124
+ * (e.g. `https://<domain>/userinfo`) when obtaining the token. A token bound to a
1125
+ * different resource-server audience is rejected by `/userinfo`.
1126
+ *
1127
+ * `/userinfo` is a bearer-protected resource and requires no client authentication, so this
1128
+ * works for public clients: the supplied access token is the only credential used.
1129
+ *
1130
+ * @param options Options containing the access token and an optional expected subject
1131
+ * for OIDC subject-consistency validation.
1132
+ * @param storeOptions Optional store options, used to resolve the domain in resolver mode.
1133
+ * @param requestOptions Optional per-request options (signal, headers, customFetch) forwarded
1134
+ * to the underlying `/userinfo` request.
1135
+ * @throws {UserInfoError} When the `/userinfo` request fails or the subject check fails.
1136
+ * @returns A Promise resolving to the UserInfo claims.
1137
+ */
1138
+ getUserInfo(options: GetUserInfoOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<UserInfoResponse>;
1139
+ getAccessToken(options: GetAccessTokenOptions & {
1140
+ fullResponse: true;
1141
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<TokenSet>>;
1047
1142
  getAccessToken(storeOptions?: TStoreOptions): Promise<TokenSet>;
1048
- getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions): Promise<TokenSet>;
1143
+ getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<TokenSet>;
1049
1144
  /**
1050
1145
  * Retrieves an access token for a connection.
1051
1146
  *
@@ -1056,12 +1151,16 @@ declare class ServerClient<TStoreOptions = unknown> {
1056
1151
  *
1057
1152
  * @param options - Options for retrieving an access token for a connection.
1058
1153
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1154
+ * @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
1155
  *
1060
1156
  * @throws {TokenForConnectionError} If the refresh token was not found or there was an issue requesting the access token.
1061
1157
  *
1062
1158
  * @returns The Connection Token Set, containing the access token for the connection, as well as additional information.
1063
1159
  */
1064
- getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions): Promise<ConnectionTokenSet>;
1160
+ getAccessTokenForConnection(options: AccessTokenForConnectionOptions & {
1161
+ fullResponse: true;
1162
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<ConnectionTokenSet>>;
1163
+ getAccessTokenForConnection(options: AccessTokenForConnectionOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ConnectionTokenSet>;
1065
1164
  /**
1066
1165
  * Revokes the refresh token stored in the current session, or an explicitly supplied token.
1067
1166
  *
@@ -1072,19 +1171,21 @@ declare class ServerClient<TStoreOptions = unknown> {
1072
1171
  *
1073
1172
  * @param options Optionally supply a token to revoke instead of reading from the session.
1074
1173
  * @param storeOptions Optional options passed to the StateStore.
1174
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the revocation request.
1075
1175
  *
1076
1176
  * @throws {MissingRequiredArgumentError} If `options.token` is an empty string.
1077
1177
  * @throws {MissingSessionError} If no refresh token is found in the session and none was provided.
1078
1178
  * @throws {TokenRevocationError} If the revocation request fails.
1079
1179
  */
1080
- revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions): Promise<void>;
1180
+ revokeRefreshToken(options?: RevokeRefreshTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<void>;
1081
1181
  /**
1082
1182
  * Logs the user out and returns a URL to redirect the user-agent to after they log out.
1083
1183
  * @param options Options used to configure the logout process.
1084
1184
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1185
+ * @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
1186
  * @returns {URL}
1086
1187
  */
1087
- logout(options: LogoutOptions, storeOptions?: TStoreOptions): Promise<URL>;
1188
+ logout(options: LogoutOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<URL>;
1088
1189
  /**
1089
1190
  * Exchanges a custom token for Auth0 tokens and persists the resulting session (RFC 8693).
1090
1191
  *
@@ -1098,13 +1199,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1098
1199
  *
1099
1200
  * @param options Options for the custom token exchange, including the subject token and its type.
1100
1201
  * @param storeOptions Optional options passed to the StateStore.
1202
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token exchange.
1101
1203
  *
1102
1204
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1103
1205
  * @throws {MissingClientAuthError} If client credentials are not configured.
1104
1206
  *
1105
1207
  * @returns A promise resolving to an object containing `authorizationDetails` when RAR was used.
1106
1208
  */
1107
- loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions, storeOptions?: TStoreOptions): Promise<LoginWithCustomTokenExchangeResult>;
1209
+ loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions & {
1210
+ fullResponse: true;
1211
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<LoginWithCustomTokenExchangeResult>>;
1212
+ loginWithCustomTokenExchange(options: LoginWithCustomTokenExchangeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<LoginWithCustomTokenExchangeResult>;
1108
1213
  /**
1109
1214
  * Exchanges a custom token for Auth0 tokens without establishing a session (RFC 8693).
1110
1215
  *
@@ -1117,13 +1222,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1117
1222
  *
1118
1223
  * @param options Options for the custom token exchange, including the subject token and its type.
1119
1224
  * @param storeOptions Optional options passed to the StateStore (used only for domain resolution in resolver mode).
1225
+ * @param requestOptions Optional per-request options (signal, headers, customFetch). Applied to the token exchange.
1120
1226
  *
1121
1227
  * @throws {TokenExchangeError} If the exchange fails or the subject token is invalid.
1122
1228
  * @throws {MissingClientAuthError} If client credentials are not configured.
1123
1229
  *
1124
1230
  * @returns A promise resolving to the token response from Auth0.
1125
1231
  */
1126
- customTokenExchange(options: CustomTokenExchangeOptions, storeOptions?: TStoreOptions): Promise<TokenResponse>;
1232
+ customTokenExchange(options: CustomTokenExchangeOptions & {
1233
+ fullResponse: true;
1234
+ }, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<ApiResponse<TokenResponse>>;
1235
+ customTokenExchange(options: CustomTokenExchangeOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<TokenResponse>;
1127
1236
  /**
1128
1237
  * Requests a Session Transfer Token (STT) for impersonation via session transfer (RFC 8693).
1129
1238
  *
@@ -1146,8 +1255,17 @@ declare class ServerClient<TStoreOptions = unknown> {
1146
1255
  * {@link ServerClient.buildSessionTransferRedirect}, which is forwarded to the target's
1147
1256
  * `/authorize` on the redirect.
1148
1257
  *
1258
+ * @remarks
1259
+ * If the actor's ID token has expired, an internal refresh is performed before the
1260
+ * session transfer token exchange. This refresh call is NOT guarded by the caller's
1261
+ * requestOptions.signal — if the signal fires during this step, the abort is ignored.
1262
+ * Only the final exchangeToken call respects the signal.
1263
+ * Thread requestOptions into #resolveSessionTransferActor in a future minor if
1264
+ * callers need full-request abort coverage.
1265
+ *
1149
1266
  * @param options Options including the developer-supplied `subjectToken`/`subjectTokenType` and an optional explicit `actor`.
1150
1267
  * @param storeOptions Optional options used to read the agent session (for the actor) and resolve the request domain.
1268
+ * @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
1269
  *
1152
1270
  * @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
1271
  * @throws {MissingClientAuthError} When client credentials are not configured (STT requires a confidential client).
@@ -1156,7 +1274,7 @@ declare class ServerClient<TStoreOptions = unknown> {
1156
1274
  *
1157
1275
  * @returns A promise resolving to a {@link SessionTransferTokenResult} containing the STT and its metadata.
1158
1276
  */
1159
- requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions): Promise<SessionTransferTokenResult>;
1277
+ requestSessionTransferToken(options: RequestSessionTransferTokenOptions, storeOptions?: TStoreOptions, requestOptions?: RequestOptions): Promise<SessionTransferTokenResult>;
1160
1278
  /**
1161
1279
  * Builds the redirect URL that hands a Session Transfer Token (STT) to the target app's login URL.
1162
1280
  *
@@ -1182,6 +1300,11 @@ declare class ServerClient<TStoreOptions = unknown> {
1182
1300
  buildSessionTransferRedirect(targetLoginUrl: string, result: SessionTransferTokenResult, options?: BuildSessionTransferRedirectOptions): URL;
1183
1301
  /**
1184
1302
  * Handles the backchannel logout process by verifying the logout token and deleting the session from the store if the logout token was considered valid.
1303
+ *
1304
+ * This does not accept `RequestOptions`. Verification does fetch JWKS, but the auth-js method it
1305
+ * delegates to, `verifyLogoutToken`, takes no `requestOptions`, so there is nothing to forward.
1306
+ * That fetch always uses the client's configured `customFetch`.
1307
+ *
1185
1308
  * @param logoutToken The logout token to verify and use to delete the session from the store.
1186
1309
  * @param storeOptions Optional options used to pass to the Transaction and State Store.
1187
1310
  *
@@ -1400,4 +1523,4 @@ declare class SessionExpiredError extends Error {
1400
1523
  constructor(message?: string);
1401
1524
  }
1402
1525
 
1403
- export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type BuildSessionTransferRedirectOptions, 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 RequestSessionTransferTokenOptions, type RevokeRefreshTokenOptions, ServerClient, type ServerClientOptions, ServerDatabaseClient, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type SessionTransferActor, type SessionTransferTokenResult, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, TokenExchangeErrorCode, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
1526
+ export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type BuildSessionTransferRedirectOptions, 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 RequestSessionTransferTokenOptions, type RevokeRefreshTokenOptions, ServerClient, type ServerClientOptions, ServerDatabaseClient, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, SessionExpiredError, type SessionStore, type SessionTransferActor, type SessionTransferTokenResult, type StartEnterpriseLoginOptions, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, TokenExchangeErrorCode, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };