@auth0/auth0-server-js 1.6.1 → 1.7.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.cjs +346 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +304 -13
- package/dist/index.d.ts +304 -13
- package/dist/index.js +345 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OtpEnrollmentResponse, TelemetryConfig, TokenExchangeError, TokenResponse, isMfaRequiredError } from '@auth0/auth0-auth-js';
|
|
1
|
+
import { AuthorizationDetails, ExchangeProfileOptions, DiscoveryCacheOptions, TelemetryConfig, AuthClient, ListAuthenticatorsOptions, AuthenticatorResponse, EnrollAuthenticatorOptions, EnrollmentResponse, ChallengeOptions, ChallengeResponse, MfaVerifyOptions, PasskeySignupChallengeOptions, PasskeySignupChallengeResponse, PasskeyLoginChallengeOptions, PasskeyLoginChallengeResponse, GetTokenByPasskeyOptions, TokenResponse } from '@auth0/auth0-auth-js';
|
|
2
|
+
export { ActClaim, AuthenticatorResponse, AuthenticatorType, ChallengeOptions, ChallengeResponse, DiscoveryCacheOptions, EnrollAuthenticatorOptions, EnrollEmailOptions, EnrollOobOptions, EnrollOtpOptions, EnrollmentResponse, ListAuthenticatorsOptions, MfaChallengeError, MfaEnrollmentError, MfaFactorType, MfaListAuthenticatorsError, MfaRequirements, MfaVerifyError, MfaVerifyOobOptions, MfaVerifyOptions, MfaVerifyOtpOptions, MfaVerifyRecoveryCodeOptions, MissingClientAuthError, OobChannel, OobEnrollmentResponse, OrganizationValidationError, OtpEnrollmentResponse, PasskeyChallengeError, PasskeyLoginChallengeOptions as PasskeyChallengeOptions, PasskeyLoginChallengeResponse as PasskeyChallengeResponse, PasskeyCreationOptions, PasskeyCredentialResponse, PasskeyGetTokenError, GetTokenByPasskeyOptions as PasskeyGetTokenOptions, PasskeyRegisterError, PasskeySignupChallengeOptions as PasskeyRegisterOptions, PasskeySignupChallengeResponse as PasskeyRegisterResponse, PasskeyRequestOptions, TelemetryConfig, TokenExchangeError, TokenResponse, isMfaRequiredError } from '@auth0/auth0-auth-js';
|
|
3
3
|
import { JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -96,7 +96,12 @@ interface SessionData {
|
|
|
96
96
|
}
|
|
97
97
|
interface TransactionData {
|
|
98
98
|
audience?: string;
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* PKCE code verifier for interactive (authorization-code) logins. Optional because
|
|
101
|
+
* magic-link transactions are bound by anti-forgery `state` only and register no PKCE
|
|
102
|
+
* challenge, so they persist no verifier.
|
|
103
|
+
*/
|
|
104
|
+
codeVerifier?: string;
|
|
100
105
|
domain?: string;
|
|
101
106
|
[key: string]: unknown;
|
|
102
107
|
}
|
|
@@ -143,6 +148,126 @@ interface LoginBackchannelOptions {
|
|
|
143
148
|
interface LoginBackchannelResult {
|
|
144
149
|
authorizationDetails?: AuthorizationDetails[];
|
|
145
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Result of completing a passkey authentication flow (signup or login).
|
|
153
|
+
*/
|
|
154
|
+
interface PasskeyGetTokenResult {
|
|
155
|
+
authorizationDetails?: AuthorizationDetails[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Options for starting an email passwordless flow by sending a one-time code (OTP).
|
|
159
|
+
*
|
|
160
|
+
* Complete it with {@link ServerClient#loginWithPasswordless}.
|
|
161
|
+
*/
|
|
162
|
+
interface StartPasswordlessEmailCodeOptions {
|
|
163
|
+
/** Discriminator: email connection. */
|
|
164
|
+
connection: 'email';
|
|
165
|
+
/** The destination email address. */
|
|
166
|
+
email: string;
|
|
167
|
+
/** Send a one-time code. Optional; this is the default for the email connection. */
|
|
168
|
+
send?: 'code';
|
|
169
|
+
/**
|
|
170
|
+
* BCP-47 language tag forwarded as `x-request-language` to localize the email template.
|
|
171
|
+
*/
|
|
172
|
+
language?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Options for starting an email passwordless magic-link flow.
|
|
176
|
+
*
|
|
177
|
+
* The SDK generates and persists an anti-forgery `state`, sends the link, and validates
|
|
178
|
+
* `state` on the callback. No PKCE is used. Complete it with
|
|
179
|
+
* {@link ServerClient#completePasswordlessMagicLink}.
|
|
180
|
+
*/
|
|
181
|
+
interface StartPasswordlessEmailLinkOptions {
|
|
182
|
+
/** Discriminator: email connection. */
|
|
183
|
+
connection: 'email';
|
|
184
|
+
/** The destination email address. */
|
|
185
|
+
email: string;
|
|
186
|
+
/** Send a magic link. Required literal to select link mode. */
|
|
187
|
+
send: 'link';
|
|
188
|
+
/**
|
|
189
|
+
* The callback URL Auth0 redirects to after the magic link is clicked. Embedded in the link
|
|
190
|
+
* as `redirect_uri`; must be registered on the application.
|
|
191
|
+
*/
|
|
192
|
+
redirectUri: string;
|
|
193
|
+
/**
|
|
194
|
+
* Additional OAuth authorization parameters merged into the link. `client_id`, `response_type`,
|
|
195
|
+
* and `state` are set by the SDK and cannot be overridden.
|
|
196
|
+
*/
|
|
197
|
+
authParams?: Record<string, unknown>;
|
|
198
|
+
/**
|
|
199
|
+
* Scope for the resulting tokens. `openid` is ensured. Include `offline_access` for a refresh token.
|
|
200
|
+
*/
|
|
201
|
+
scope?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Audience for the resulting access token.
|
|
204
|
+
*/
|
|
205
|
+
audience?: string;
|
|
206
|
+
/**
|
|
207
|
+
* BCP-47 language tag forwarded as `x-request-language` to localize the email template.
|
|
208
|
+
*/
|
|
209
|
+
language?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Options for starting an SMS passwordless flow (one-time code only; SMS has no magic link).
|
|
213
|
+
*
|
|
214
|
+
* Complete it with {@link ServerClient#loginWithPasswordless}.
|
|
215
|
+
*/
|
|
216
|
+
interface StartPasswordlessSmsOptions {
|
|
217
|
+
/** Discriminator: sms connection. */
|
|
218
|
+
connection: 'sms';
|
|
219
|
+
/** Phone number in E.164 format, e.g. `+14155550100`. */
|
|
220
|
+
phoneNumber: string;
|
|
221
|
+
/**
|
|
222
|
+
* BCP-47 language tag forwarded as `x-request-language` to localize the SMS template.
|
|
223
|
+
*/
|
|
224
|
+
language?: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Options for starting a passwordless flow. Discriminated on `connection` (and, for email,
|
|
228
|
+
* on `send`) to mirror the `@auth0/nextjs-auth0` `passwordless.start()` surface.
|
|
229
|
+
*
|
|
230
|
+
* - `{ connection: 'email', send?: 'code' }` — email OTP (default)
|
|
231
|
+
* - `{ connection: 'email', send: 'link', redirectUri }` — email magic link
|
|
232
|
+
* - `{ connection: 'sms' }` — SMS OTP
|
|
233
|
+
*/
|
|
234
|
+
type StartPasswordlessOptions = StartPasswordlessEmailCodeOptions | StartPasswordlessEmailLinkOptions | StartPasswordlessSmsOptions;
|
|
235
|
+
/**
|
|
236
|
+
* Options for completing an email passwordless OTP login and establishing a session.
|
|
237
|
+
*/
|
|
238
|
+
interface CompletePasswordlessEmailOptions {
|
|
239
|
+
/** Discriminator: email connection. */
|
|
240
|
+
connection: 'email';
|
|
241
|
+
/** The email address the code was sent to. */
|
|
242
|
+
email: string;
|
|
243
|
+
/** The one-time code entered by the user. */
|
|
244
|
+
verificationCode: string;
|
|
245
|
+
authorizationParams?: AuthorizationParameters;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Options for completing an SMS passwordless OTP login and establishing a session.
|
|
249
|
+
*/
|
|
250
|
+
interface CompletePasswordlessSmsOptions {
|
|
251
|
+
/** Discriminator: sms connection. */
|
|
252
|
+
connection: 'sms';
|
|
253
|
+
/** The phone number the code was sent to, in E.164 format. */
|
|
254
|
+
phoneNumber: string;
|
|
255
|
+
/** The one-time code entered by the user. */
|
|
256
|
+
verificationCode: string;
|
|
257
|
+
authorizationParams?: AuthorizationParameters;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Options for completing a passwordless OTP login. Discriminated on `connection` to mirror the
|
|
261
|
+
* `@auth0/nextjs-auth0` `passwordless.verify()` surface.
|
|
262
|
+
*/
|
|
263
|
+
type CompletePasswordlessOptions = CompletePasswordlessEmailOptions | CompletePasswordlessSmsOptions;
|
|
264
|
+
/**
|
|
265
|
+
* Result of a passwordless login (OTP or magic link). The session is persisted to the state
|
|
266
|
+
* store; `authorizationDetails` is included when Rich Authorization Requests (RAR) were used.
|
|
267
|
+
*/
|
|
268
|
+
interface CompletePasswordlessResult {
|
|
269
|
+
authorizationDetails?: AuthorizationDetails[];
|
|
270
|
+
}
|
|
146
271
|
interface AccessTokenForConnectionOptions {
|
|
147
272
|
connection: string;
|
|
148
273
|
loginHint?: string;
|
|
@@ -355,6 +480,89 @@ declare class ServerMfaClient<TStoreOptions = unknown> {
|
|
|
355
480
|
verify(options: MfaVerifyOptions, storeOptions?: TStoreOptions): Promise<MfaVerifyResponse>;
|
|
356
481
|
}
|
|
357
482
|
|
|
483
|
+
/**
|
|
484
|
+
* @internal
|
|
485
|
+
* Options for constructing a ServerPasskeyClient.
|
|
486
|
+
*
|
|
487
|
+
* Unlike the MFA client, the passkey client resolves the domain per call so it
|
|
488
|
+
* keeps working in resolver (multi-tenant) mode. It therefore receives the
|
|
489
|
+
* parent client's `resolveDomain` and `getAuthClient` helpers instead of a
|
|
490
|
+
* fixed domain/authClient.
|
|
491
|
+
*/
|
|
492
|
+
interface ServerPasskeyClientOptions<TStoreOptions = unknown> {
|
|
493
|
+
resolveDomain: (storeOptions?: TStoreOptions) => Promise<string>;
|
|
494
|
+
getAuthClient: (domain: string) => AuthClient;
|
|
495
|
+
stateStore: StateStore<TStoreOptions>;
|
|
496
|
+
stateStoreIdentifier: string;
|
|
497
|
+
defaultScope?: string;
|
|
498
|
+
defaultAudience?: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class ServerPasskeyClient<TStoreOptions = unknown> {
|
|
502
|
+
#private;
|
|
503
|
+
/**
|
|
504
|
+
* @internal
|
|
505
|
+
*/
|
|
506
|
+
constructor(options: ServerPasskeyClientOptions<TStoreOptions>);
|
|
507
|
+
/**
|
|
508
|
+
* Requests a passkey signup challenge for a new user.
|
|
509
|
+
*
|
|
510
|
+
* Returns the `authSession` and the WebAuthn credential creation options
|
|
511
|
+
* (`authnParamsPublicKey`). The application must return these to the browser,
|
|
512
|
+
* pass `authnParamsPublicKey` to `navigator.credentials.create()`, and then
|
|
513
|
+
* call `getToken()` with the resulting credential to complete signup.
|
|
514
|
+
*
|
|
515
|
+
* This method does not create a session; no state is persisted.
|
|
516
|
+
*
|
|
517
|
+
* @param options User profile data and optional realm/organization.
|
|
518
|
+
* @param storeOptions Optional options used to resolve the domain (resolver mode).
|
|
519
|
+
*
|
|
520
|
+
* @throws {PasskeyRegisterError} If there was an issue requesting the signup challenge.
|
|
521
|
+
*
|
|
522
|
+
* @returns A promise resolving to the signup challenge.
|
|
523
|
+
*/
|
|
524
|
+
register(options: PasskeySignupChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeySignupChallengeResponse>;
|
|
525
|
+
/**
|
|
526
|
+
* Requests a passkey login challenge for an existing user.
|
|
527
|
+
*
|
|
528
|
+
* Returns the `authSession` and the WebAuthn credential request options
|
|
529
|
+
* (`authnParamsPublicKey`). The application must return these to the browser,
|
|
530
|
+
* pass `authnParamsPublicKey` to `navigator.credentials.get()`, and then
|
|
531
|
+
* call `getToken()` with the resulting credential to complete login.
|
|
532
|
+
*
|
|
533
|
+
* This method does not create a session; no state is persisted.
|
|
534
|
+
*
|
|
535
|
+
* @param options Optional realm/organization configuration.
|
|
536
|
+
* @param storeOptions Optional options used to resolve the domain (resolver mode).
|
|
537
|
+
*
|
|
538
|
+
* @throws {PasskeyChallengeError} If there was an issue requesting the login challenge.
|
|
539
|
+
*
|
|
540
|
+
* @returns A promise resolving to the login challenge.
|
|
541
|
+
*/
|
|
542
|
+
challenge(options?: PasskeyLoginChallengeOptions, storeOptions?: TStoreOptions): Promise<PasskeyLoginChallengeResponse>;
|
|
543
|
+
/**
|
|
544
|
+
* Completes a passkey authentication flow (signup or login) by exchanging the
|
|
545
|
+
* WebAuthn credential for tokens, and persists the resulting session.
|
|
546
|
+
*
|
|
547
|
+
* Call this after obtaining a credential from `navigator.credentials.create()`
|
|
548
|
+
* (signup) or `navigator.credentials.get()` (login), passing the `authSession`
|
|
549
|
+
* returned by `register()` / `challenge()` together with the serialized credential.
|
|
550
|
+
*
|
|
551
|
+
* In resolver (multi-tenant) mode, pass the same `storeOptions` you passed to
|
|
552
|
+
* `register()` / `challenge()` so the token exchange resolves the same tenant
|
|
553
|
+
* that issued the `authSession`; otherwise the exchange will fail.
|
|
554
|
+
*
|
|
555
|
+
* @param options The auth session, serialized credential, and optional realm/scope/audience/organization.
|
|
556
|
+
* @param storeOptions Optional options used to pass to the State Store (and to resolve the domain in resolver mode).
|
|
557
|
+
*
|
|
558
|
+
* @throws {PasskeyGetTokenError} If there was an issue exchanging the credential for tokens. When the cause is `mfa_required`, use `isMfaRequiredError(error)` to narrow the error and read `cause.mfa_token`. No session is persisted in this case.
|
|
559
|
+
* @throws {OrganizationValidationError} When `organization` is passed and the returned ID token's organization claim is missing or does not match. The error is thrown before the session is written, so no session is persisted in this case.
|
|
560
|
+
*
|
|
561
|
+
* @returns A promise resolving to an object containing the authorizationDetails (when RAR was used).
|
|
562
|
+
*/
|
|
563
|
+
getToken(options: GetTokenByPasskeyOptions, storeOptions?: TStoreOptions): Promise<PasskeyGetTokenResult>;
|
|
564
|
+
}
|
|
565
|
+
|
|
358
566
|
declare class ServerClient<TStoreOptions = unknown> {
|
|
359
567
|
#private;
|
|
360
568
|
/**
|
|
@@ -381,6 +589,17 @@ declare class ServerClient<TStoreOptions = unknown> {
|
|
|
381
589
|
* In resolver mode (`domain` as a function), MFA is not supported.
|
|
382
590
|
*/
|
|
383
591
|
get mfa(): ServerMfaClient<TStoreOptions>;
|
|
592
|
+
/**
|
|
593
|
+
* The passkey client for signing up and logging in users with WebAuthn credentials.
|
|
594
|
+
*
|
|
595
|
+
* Provides `register()` and `challenge()` to request signup/login challenges, and
|
|
596
|
+
* `getToken()` to exchange the resulting credential for tokens and persist the session.
|
|
597
|
+
*
|
|
598
|
+
* Unlike `mfa`, this property is available in both static and resolver (multi-tenant)
|
|
599
|
+
* domain modes. In resolver mode, pass the same `storeOptions` to `register()`/`challenge()`
|
|
600
|
+
* and `getToken()` so the credential is exchanged against the tenant that issued it.
|
|
601
|
+
*/
|
|
602
|
+
get passkey(): ServerPasskeyClient<TStoreOptions>;
|
|
384
603
|
constructor(options: ServerClientOptions<TStoreOptions>);
|
|
385
604
|
/**
|
|
386
605
|
* Starts the interactive login process, and returns a URL to redirect the user-agent to to request authorization at Auth0.
|
|
@@ -470,6 +689,86 @@ declare class ServerClient<TStoreOptions = unknown> {
|
|
|
470
689
|
* @returns A promise resolving to an object, containing the authorizationDetails (when RAR was used).
|
|
471
690
|
*/
|
|
472
691
|
loginBackchannel(options: LoginBackchannelOptions, storeOptions?: TStoreOptions): Promise<LoginBackchannelResult>;
|
|
692
|
+
/**
|
|
693
|
+
* Starts a passwordless flow by sending a one-time code (OTP) or a magic link.
|
|
694
|
+
*
|
|
695
|
+
* Discriminated on `connection` (and, for email, `send`) to mirror the
|
|
696
|
+
* `@auth0/nextjs-auth0` `passwordless.start()` surface:
|
|
697
|
+
* - `{ connection: 'email' }` / `{ connection: 'email', send: 'code' }` — email OTP
|
|
698
|
+
* - `{ connection: 'email', send: 'link', redirectUri }` — email magic link
|
|
699
|
+
* - `{ connection: 'sms' }` — SMS OTP
|
|
700
|
+
*
|
|
701
|
+
* OTP modes are a stateless passthrough to the Authentication API (no session, no transaction);
|
|
702
|
+
* complete them with {@link ServerClient#completePasswordless}.
|
|
703
|
+
*
|
|
704
|
+
* Magic-link mode is stateful: the SDK generates an opaque anti-forgery `state`, sends the link
|
|
705
|
+
* with the OAuth parameters embedded (`redirect_uri`, `response_type=code`, `scope`, `state`),
|
|
706
|
+
* and persists a transaction carrying that `state`. NO PKCE challenge is registered, so the
|
|
707
|
+
* transaction holds no `codeVerifier`. Complete it with
|
|
708
|
+
* {@link ServerClient#completePasswordlessMagicLink}. Requires the tenant setting
|
|
709
|
+
* `allow_magiclink_verify_without_session: true` for server-side completion.
|
|
710
|
+
*
|
|
711
|
+
* @param options Discriminated start options.
|
|
712
|
+
* @param storeOptions Optional options passed to the resolver / stores.
|
|
713
|
+
*
|
|
714
|
+
* @throws {PasswordlessStartError} If the request fails, or if a magic link is requested without a `redirectUri`.
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* // Email OTP
|
|
718
|
+
* await serverClient.startPasswordless({ connection: 'email', email: 'user@example.com' });
|
|
719
|
+
* // SMS OTP
|
|
720
|
+
* await serverClient.startPasswordless({ connection: 'sms', phoneNumber: '+14155550100' });
|
|
721
|
+
* // Email magic link
|
|
722
|
+
* await serverClient.startPasswordless({
|
|
723
|
+
* connection: 'email',
|
|
724
|
+
* email: 'user@example.com',
|
|
725
|
+
* send: 'link',
|
|
726
|
+
* redirectUri: 'https://app.example.com/auth/callback',
|
|
727
|
+
* });
|
|
728
|
+
*/
|
|
729
|
+
startPasswordless(options: StartPasswordlessOptions, storeOptions?: TStoreOptions): Promise<void>;
|
|
730
|
+
/**
|
|
731
|
+
* Completes a passwordless OTP login and persists the resulting session.
|
|
732
|
+
*
|
|
733
|
+
* Discriminated on `connection` to mirror the `@auth0/nextjs-auth0` `passwordless.verify()`
|
|
734
|
+
* surface. Non-redirect flow: no PKCE and no transaction store (mirrors
|
|
735
|
+
* {@link ServerClient#loginBackchannel}). The `openid` scope is always ensured by this layer.
|
|
736
|
+
*
|
|
737
|
+
* Note: the state store is read-then-written; if your deployment performs concurrent
|
|
738
|
+
* logins for the same session identifier, use a state store with atomic/serializable
|
|
739
|
+
* writes to avoid last-write-wins races.
|
|
740
|
+
*
|
|
741
|
+
* @param options Discriminated completion options (`connection`, identifier, `verificationCode`).
|
|
742
|
+
* @param storeOptions Optional options passed to the resolver / stores.
|
|
743
|
+
*
|
|
744
|
+
* @throws {PasswordlessVerifyError} If the code is invalid, expired, or rate-limited. When the
|
|
745
|
+
* connection requires MFA, the server responds with `mfa_required`; narrow the thrown error
|
|
746
|
+
* with `isMfaRequiredError(error)` to read `cause.mfa_token`.
|
|
747
|
+
*
|
|
748
|
+
* @returns A promise resolving to the authorizationDetails (when RAR was used).
|
|
749
|
+
*/
|
|
750
|
+
completePasswordless(options: CompletePasswordlessOptions, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
|
|
751
|
+
/**
|
|
752
|
+
* Completes a passwordless magic-link login and persists the resulting session.
|
|
753
|
+
*
|
|
754
|
+
* Loads the transaction persisted by {@link ServerClient#startPasswordless} (magic-link mode), validates the
|
|
755
|
+
* `state` returned on the callback URL against the stored `state` (anti-forgery binding), exchanges
|
|
756
|
+
* the authorization code WITHOUT PKCE, writes the session, and deletes the transaction. The existing
|
|
757
|
+
* interactive login path ({@link ServerClient#completeInteractiveLogin}) is not used.
|
|
758
|
+
*
|
|
759
|
+
* @param url The callback URL containing the authorization `code` and `state`.
|
|
760
|
+
* @param storeOptions Optional options passed to the resolver / stores.
|
|
761
|
+
*
|
|
762
|
+
* @throws {MissingTransactionError} If no magic-link transaction was found.
|
|
763
|
+
* @throws {PasswordlessVerifyError} If the returned `state` is missing or does not match.
|
|
764
|
+
* @throws {TokenByCodeError} If the token exchange fails.
|
|
765
|
+
*
|
|
766
|
+
* @returns A promise resolving to the authorizationDetails (when RAR was used).
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* const result = await serverClient.completePasswordlessMagicLink(callbackUrl, storeOptions);
|
|
770
|
+
*/
|
|
771
|
+
completePasswordlessMagicLink(url: URL, storeOptions?: TStoreOptions): Promise<CompletePasswordlessResult>;
|
|
473
772
|
/**
|
|
474
773
|
* Retrieves the user from the store, or undefined if no user found.
|
|
475
774
|
* @param storeOptions Optional options used to pass to the Transaction and State Store.
|
|
@@ -482,16 +781,8 @@ declare class ServerClient<TStoreOptions = unknown> {
|
|
|
482
781
|
* @returns The session or undefined if no session found in the store.
|
|
483
782
|
*/
|
|
484
783
|
getSession(storeOptions?: TStoreOptions): Promise<SessionData | undefined>;
|
|
485
|
-
/**
|
|
486
|
-
* Retrieves the access token from the store, or calls Auth0 when the access token is expired and a refresh token is available in the store.
|
|
487
|
-
* Also updates the store when a new token was retrieved from Auth0.
|
|
488
|
-
* @param storeOptions Optional options used to pass to the Transaction and State Store.
|
|
489
|
-
*
|
|
490
|
-
* @throws {TokenByRefreshTokenError} If the refresh token was not found or there was an issue requesting the access token. When the cause is `mfa_required`, use `isMfaRequiredError(error)` to narrow the error and read `cause.mfa_token`.
|
|
491
|
-
*
|
|
492
|
-
* @returns The Token Set, containing the access token, as well as additional information.
|
|
493
|
-
*/
|
|
494
784
|
getAccessToken(storeOptions?: TStoreOptions): Promise<TokenSet>;
|
|
785
|
+
getAccessToken(options: GetAccessTokenOptions, storeOptions?: TStoreOptions): Promise<TokenSet>;
|
|
495
786
|
/**
|
|
496
787
|
* Retrieves an access token for a connection.
|
|
497
788
|
*
|
|
@@ -740,4 +1031,4 @@ declare class IssuerValidationError extends Error {
|
|
|
740
1031
|
constructor(message: string);
|
|
741
1032
|
}
|
|
742
1033
|
|
|
743
|
-
export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, 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, ServerClient, type ServerClientOptions, ServerMfaClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
|
|
1034
|
+
export { type AbstractDataStore, AbstractStateStore, AbstractTransactionStore, type AccessTokenForConnectionOptions, type AuthorizationParameters, BackchannelLogoutError, type CompletePasswordlessEmailOptions, type CompletePasswordlessOptions, type CompletePasswordlessResult, type CompletePasswordlessSmsOptions, type ConnectionTokenSet, type CookieHandler, type CookieSerializeOptions, CookieTransactionStore, type CustomTokenExchangeOptions, type DomainResolver, type EncryptedStoreOptions, type GetAccessTokenOptions, type InternalStateData, InvalidConfigurationError, IssuerValidationError, type LoginBackchannelOptions, type LoginBackchannelResult, type LoginWithCustomTokenExchangeOptions, type LoginWithCustomTokenExchangeResult, type LogoutOptions, type LogoutTokenClaims, type MfaVerifyResponse, MissingRequiredArgumentError, MissingSessionError, MissingTransactionError, type PasskeyGetTokenResult, ServerClient, type ServerClientOptions, ServerMfaClient, ServerPasskeyClient, type SessionConfiguration, type SessionCookieOptions, type SessionData, type SessionStore, type StartInteractiveLoginOptions, StartLinkUserError, type StartLinkUserOptions, type StartPasswordlessEmailCodeOptions, type StartPasswordlessEmailLinkOptions, type StartPasswordlessOptions, type StartPasswordlessSmsOptions, type StartUnlinkUserOptions, type StateData, type StateStore, StatefulStateStore, type StatefulStateStoreOptions, StatelessStateStore, type TokenSet, type TransactionData, type TransactionStore, type UserClaims };
|