@passflow/core 0.27.0 → 0.29.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
@@ -1287,13 +1287,21 @@ export type PassflowResponseError = {
1287
1287
  time: string;
1288
1288
  };
1289
1289
  };
1290
+ /** Id of the error a call rejects with when the Passflow API cannot be reached or its gateway answers 502, 503 or 504. */
1291
+ export declare const SERVICE_UNAVAILABLE_ERROR_ID = "error.service.unavailable";
1292
+ /** Message of the {@link SERVICE_UNAVAILABLE_ERROR_ID} error. */
1293
+ export declare const SERVICE_UNAVAILABLE_MESSAGE = "Passflow is temporarily unavailable. Please try again in a moment.";
1290
1294
  export declare class PassflowError extends Error {
1291
1295
  id: string;
1292
1296
  message: string;
1293
1297
  status: number;
1294
1298
  location: string;
1295
1299
  time: string;
1296
- constructor(error: PassflowResponseError['error']);
1300
+ /** Declared here rather than inherited: `Error.cause` is ES2022 and this build targets ES2021 libs. */
1301
+ readonly cause?: unknown;
1302
+ constructor(error: PassflowResponseError['error'], options?: {
1303
+ cause?: unknown;
1304
+ });
1297
1305
  }
1298
1306
  export type PassflowSignInPayload = {
1299
1307
  password: string;
@@ -1396,6 +1404,17 @@ export type PassflowPasswordlessStatusResponse = {
1396
1404
  } | {
1397
1405
  status: 'approved';
1398
1406
  code: string;
1407
+ } |
1408
+ /**
1409
+ * A sign-in under an OIDC parent ends where every parent sign-in ends: with the relying party's
1410
+ * `redirect_url`, or with a `tfa_token` when a second factor is owed.
1411
+ */
1412
+ {
1413
+ status?: undefined;
1414
+ redirect_url?: string;
1415
+ tfa_token?: string;
1416
+ requires_2fa?: boolean;
1417
+ challenge_id?: string;
1399
1418
  };
1400
1419
  export type PassflowPasswordlessApprovalInfoPayload = {
1401
1420
  challenge_id: string;
@@ -1409,6 +1428,10 @@ export type PassflowPasswordlessApprovalDecidePayload = {
1409
1428
  export type PassflowPasswordlessApprovalDecideResponse = {
1410
1429
  state: 'approved' | 'denied';
1411
1430
  };
1431
+ /**
1432
+ * How a passwordless wait ended. Under an OIDC parent, `signed-in` carries only `redirect_url`
1433
+ * (the relying party's address with its code) in `tokens`, and no tokens.
1434
+ */
1412
1435
  export type PasswordlessWaitResult = {
1413
1436
  status: 'signed-in';
1414
1437
  tokens: PassflowAuthorizationResponse;
@@ -1427,6 +1450,8 @@ export type PasswordlessApprovalInfo = {
1427
1450
  country: string;
1428
1451
  } | null;
1429
1452
  attempts_left: number;
1453
+ /** `true` when approving takes one click and no number is typed. */
1454
+ one_click?: boolean;
1430
1455
  };
1431
1456
  export declare enum Providers {
1432
1457
  google = "google",
@@ -1470,7 +1495,16 @@ export type AppSettings = {
1470
1495
  custom_email_templates: boolean;
1471
1496
  auth_strategies: AuthStrategies[];
1472
1497
  force_passwordless_login: boolean;
1498
+ /**
1499
+ * `true`: hosted sign-in returns an authorization code (SDK mode), which `authRedirect()` redeems.
1500
+ * `false`: hosted sign-in returns tokens in the URL (Simple mode).
1501
+ */
1473
1502
  pkce_enabled: boolean;
1503
+ /**
1504
+ * `true` when the app is a public client (no secret), so a browser can redeem its code. Absent
1505
+ * on servers that do not report it.
1506
+ */
1507
+ public_client?: boolean;
1474
1508
  custom_sms_messages: boolean;
1475
1509
  registration_allowed: boolean;
1476
1510
  invite_only_registration: boolean;
@@ -1602,6 +1636,10 @@ export type PassflowFederatedAuthPayload = {
1602
1636
  create_tenant?: boolean;
1603
1637
  code_challenge?: string;
1604
1638
  code_challenge_method?: 'S256';
1639
+ /** Echoed back on a Simple-mode landing, so the app can match the return to its start. */
1640
+ state?: string;
1641
+ /** The hosted login's OIDC parent sign-in, when the federated sign-in runs under one. */
1642
+ parent_challenge_id?: string;
1605
1643
  };
1606
1644
  export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
1607
1645
  device?: string;
@@ -3296,6 +3334,41 @@ export declare class M2MTokenParseError extends M2MError {
3296
3334
  export declare class M2MConfigError extends M2MError {
3297
3335
  constructor(message: string);
3298
3336
  }
3337
+ /**
3338
+ * Codes of the errors the hosted sign-in in SDK mode (authorization code + PKCE) reports, both as
3339
+ * `PassflowOidcError.code` on a rejected `authRedirect()` and as `ErrorPayload.code` on the
3340
+ * `Error` event. A landing whose token endpoint answered with an OAuth error other than
3341
+ * `invalid_client` or `invalid_grant` reports `TOKEN_EXCHANGE_FAILED`; an `?error=` landing reports
3342
+ * the OAuth error code the server sent.
3343
+ */
3344
+ type OidcErrorCode =
3345
+ /** `authRedirect()` got a `url` or `appId` that differs from the instance's. */
3346
+ 'OVERRIDE_NOT_SUPPORTED' |
3347
+ /** The page is not a secure context, so the Web Crypto API that PKCE needs is missing. */
3348
+ 'SECURE_CONTEXT_REQUIRED' |
3349
+ /** sessionStorage cannot be written, so the proof key cannot survive the redirect. */
3350
+ 'STORAGE_UNAVAILABLE' |
3351
+ /** The app is a confidential client (it has a secret), so a browser cannot redeem its code. */
3352
+ 'CONFIDENTIAL_CLIENT' |
3353
+ /** The landing's `state` is not the one this tab sent. */
3354
+ 'STATE_MISMATCH' |
3355
+ /** This tab's stored proof key is unreadable or expired. */
3356
+ 'VERIFIER_MISSING' |
3357
+ /** The ID token is missing although `openid` was asked, or its `nonce` is not the one sent. */
3358
+ 'ID_TOKEN_INVALID' |
3359
+ /** The token endpoint could not be reached or answered with an unexpected error. */
3360
+ 'TOKEN_EXCHANGE_FAILED' |
3361
+ /** The token endpoint refused the client: it needs a secret. */
3362
+ 'invalid_client' |
3363
+ /** The token endpoint refused the code. */
3364
+ 'invalid_grant' |
3365
+ /** URL tokens were received but the app is not known to be in Simple mode. */
3366
+ 'TOKENS_IN_URL_NOT_ALLOWED';
3367
+ /** An error of the hosted sign-in in SDK mode, with a code a caller can branch on. */
3368
+ export declare class PassflowOidcError extends Error {
3369
+ readonly code: OidcErrorCode | (string & {});
3370
+ constructor(code: OidcErrorCode | (string & {}), message: string);
3371
+ }
3299
3372
  /**
3300
3373
  * Logger interface for Passflow services
3301
3374
  */
@@ -3446,7 +3519,7 @@ export declare enum PassflowEvent {
3446
3519
  * The SDK operation that failed (`ErrorPayload.operation`). The SDK sets it on every `Error` it
3447
3520
  * emits, so a subscriber can tell a failed sign-in from a failed refresh without parsing messages.
3448
3521
  */
3449
- type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke';
3522
+ type PassflowOperation = 'sign-in' | 'sign-up' | 'passwordless.start' | 'passwordless.complete' | 'passwordless.wait' | 'passwordless.approval' | 'password-reset.send' | 'password-reset.complete' | 'email-verification.complete' | 'passkey.register' | 'passkey.authenticate' | 'federated.popup' | 'federated.redirect' | 'auth-redirect.url' | 'auth-redirect' | 'redirect.check' | 'auth.is-authenticated' | 'session.check' | 'tokens.get' | 'tokens.load' | 'tokens.from-url' | 'oidc.redirect' | 'refresh' | 'upgrade.commit' | 'log-out' | 'reset' | 'settings.app' | 'settings.all' | 'settings.password-policy' | 'settings.passkey' | 'passkey.list' | 'passkey.rename' | 'passkey.delete' | 'passkey.add' | 'tenant.create' | 'invitation.join' | 'invitation.request-link' | 'invitation.list' | 'invitation.delete' | 'invitation.resend' | 'invitation.get-link' | '2fa.status' | '2fa.setup.begin' | '2fa.setup.confirm' | '2fa.enrollment.read' | '2fa.enrollment.setup-link' | '2fa.verify' | '2fa.recovery.use' | '2fa.disable' | '2fa.recovery.regenerate' | '2fa.methods.available' | '2fa.methods.registered' | '2fa.method.setup.start' | '2fa.method.setup.complete' | '2fa.method.remove' | '2fa.challenge.request' | '2fa.challenge.verify' | '2fa.method.switch' | '2fa.trusted-devices.list' | '2fa.trusted-devices.revoke';
3450
3523
  /**
3451
3524
  * Error payload interface for structured error information
3452
3525
  */
@@ -3480,8 +3553,11 @@ type PassflowEventPayload = {
3480
3553
  /**
3481
3554
  * `'federated-landing'`: a federated redirect landed here and this instance exchanged its code.
3482
3555
  * `'tokens-in-url'`: tokens received in this page's URL were verified and saved.
3556
+ * `'oidc-landing'`: hosted sign-in returned an authorization code here and this instance redeemed it.
3483
3557
  */
3484
- source?: 'federated-landing' | 'tokens-in-url';
3558
+ source?: 'federated-landing' | 'tokens-in-url' | 'oidc-landing';
3559
+ /** For `source: 'tokens-in-url'`: the `state` the URL carried with the tokens, when it had one. */
3560
+ state?: string;
3485
3561
  };
3486
3562
  [PassflowEvent.SignInStart]: {
3487
3563
  email?: string;
@@ -3700,6 +3776,15 @@ export declare class TokenCacheService {
3700
3776
  getParsedTokens(): ParsedTokens | undefined;
3701
3777
  isExpired(): boolean;
3702
3778
  }
3779
+ /** Options of `authRedirect()`. `url` and `appId` may only repeat the instance's own values. */
3780
+ export type AuthRedirectOptions = {
3781
+ url?: string;
3782
+ redirectUrl?: string;
3783
+ scopes?: string[];
3784
+ appId?: string;
3785
+ /** Simple mode only: echoed back with the tokens. In SDK mode the SDK generates `state` itself. */
3786
+ state?: string;
3787
+ };
3703
3788
  /** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
3704
3789
  export type AuthServiceRefreshOptions = {
3705
3790
  coordination: ResolvedCoordination;
@@ -3722,6 +3807,8 @@ export declare class AuthService {
3722
3807
  private appId?;
3723
3808
  private platform;
3724
3809
  private readPkceEnabled?;
3810
+ /** The app's settings, read once per app id; `undefined` while there is no app id. */
3811
+ private readAppSettings?;
3725
3812
  private tokenDeliveryManager;
3726
3813
  private tokenExchangeConfig?;
3727
3814
  private pendingPkce?;
@@ -3744,7 +3831,16 @@ export declare class AuthService {
3744
3831
  parsedTokens?: ParsedTokens;
3745
3832
  }) => Promise<void>;
3746
3833
  expiredSession?: () => Promise<void>;
3747
- }, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions);
3834
+ }, appId?: string | undefined, tokenExchangeConfig?: TokenExchangeConfig, platform?: PlatformAdapter, readPkceEnabled?: (() => Promise<boolean>) | undefined, refreshOptions?: AuthServiceRefreshOptions,
3835
+ /** The app's settings, read once per app id; `undefined` while there is no app id. */
3836
+ readAppSettings?: (() => Promise<AppSettings | undefined>) | undefined);
3837
+ /** The app id used for `client_id`, the override check, federated starts and landings. */
3838
+ setAppId(appId: string): void;
3839
+ /**
3840
+ * Whether the app is known to be in Simple mode (`pkce_enabled === false`), the only mode in
3841
+ * which tokens are accepted from a URL. An unknown mode (no app id, a failed read) is not.
3842
+ */
3843
+ private isSimpleModeApp;
3748
3844
  /**
3749
3845
  * Initialize session state on page load for cookie/BFF mode
3750
3846
  */
@@ -4000,12 +4096,24 @@ export declare class AuthService {
4000
4096
  scopes?: string[];
4001
4097
  appId?: string;
4002
4098
  }): string;
4003
- authRedirect(options?: {
4004
- url?: string;
4005
- redirectUrl?: string;
4006
- scopes?: string[];
4007
- appId?: string;
4008
- }): void;
4099
+ /**
4100
+ * Sends the user to hosted sign-in, in the app's mode. Simple (`pkce_enabled` false or absent,
4101
+ * or no app id): the `/web` URL of `authRedirectUrl()`, plus `state` when given. SDK
4102
+ * (`pkce_enabled` true): `/oidc/authorize` with PKCE, `state` generated here, and `redirect_uri`
4103
+ * = `redirectUrl` or this page's origin and pathname.
4104
+ *
4105
+ * Every failure is one `Error` with operation `auth-redirect` and a rejection; nothing navigates.
4106
+ */
4107
+ authRedirect(options?: AuthRedirectOptions): Promise<void>;
4108
+ /**
4109
+ * Takes a hosted sign-in landing in SDK mode (`?code=&state=`, or `?error=&state=`).
4110
+ *
4111
+ * @returns false with no app id yet, or with no slot in this tab: nothing is touched and no event
4112
+ * follows. true when this tab holds a slot: the URL is cleaned now, and `SignIn` with
4113
+ * `source: 'oidc-landing'` or one `Error` with operation `oidc.redirect` follows after an await.
4114
+ */
4115
+ handleOidcLanding(currentUrl: CurrentUrlInfo): boolean;
4116
+ private finishOidcLanding;
4009
4117
  /**
4010
4118
  * Check if user is authenticated
4011
4119
  * CRITICAL: Cookie/BFF mode checks ID token + session state, NOT access_token
@@ -5428,7 +5536,7 @@ export declare class Passflow {
5428
5536
  private readonly upgradeDomain;
5429
5537
  private createSessionCallback?;
5430
5538
  private expiredSessionCallback?;
5431
- private pkceEnabledRead?;
5539
+ private appSettingsRead?;
5432
5540
  error?: Error;
5433
5541
  private platform;
5434
5542
  get origin(): string;
@@ -5436,10 +5544,13 @@ export declare class Passflow {
5436
5544
  appId?: string;
5437
5545
  constructor(config: PassflowConfig);
5438
5546
  /**
5439
- * Whether the current app wants PKCE. A sign-in asks before a passkey ceremony,
5440
- * where a round-trip eats into the browser's user-gesture window, so the answer
5441
- * is kept for the appId. A failed read is not kept: the next sign-in asks again.
5547
+ * The current app's settings, `undefined` while there is no app id. A sign-in asks before a
5548
+ * passkey ceremony, where a round-trip eats into the browser's user-gesture window, and
5549
+ * `authRedirect()`, the URL-token reader and `getAppSettings()` ask too, so one read is kept for
5550
+ * the appId. A failed read is not kept: the next caller asks again.
5442
5551
  */
5552
+ private readAppSettings;
5553
+ /** Whether the current app wants PKCE; `false` while there is no app id. */
5443
5554
  private readPkceEnabled;
5444
5555
  /**
5445
5556
  * Update the appId and propagate it to all API clients.
@@ -5616,10 +5727,12 @@ export declare class Passflow {
5616
5727
  * Handle OAuth redirect callback and take tokens from the URL query or fragment.
5617
5728
  * This method should be called on the redirect page after authentication.
5618
5729
  *
5619
- * The tokens are removed from the URL at once, then verified in the background against the
5620
- * configured server's published keys and this app id (required). `SignIn` with
5621
- * `source: 'tokens-in-url'` (tokens saved), or `Error` with operation `tokens.from-url` (nothing
5622
- * saved), reports the outcome, so subscribe first.
5730
+ * The tokens are removed from the URL at once. Core accepts URL tokens only for apps in Simple
5731
+ * mode: the app settings are read (`pkce_enabled` must be `false`; an SDK-mode app, no app id or
5732
+ * a failed read is refused with code `TOKENS_IN_URL_NOT_ALLOWED`), then the tokens are verified in
5733
+ * the background against the configured server's published keys and this app id. `SignIn` with
5734
+ * `source: 'tokens-in-url'` (tokens saved; `state` set when the URL carried one), or `Error` with
5735
+ * operation `tokens.from-url` (nothing saved), reports the outcome, so subscribe first.
5623
5736
  *
5624
5737
  * @example
5625
5738
  * ```typescript
@@ -5631,19 +5744,24 @@ export declare class Passflow {
5631
5744
  * passflow.handleTokensRedirect();
5632
5745
  * ```
5633
5746
  *
5634
- * A PKCE federated landing (`?code=`) returns `undefined` and finishes in the background: `SignIn`
5635
- * or `TwoFactorRequired` is the signal. With `deferFederatedLanding` it is left to
5747
+ * A PKCE federated landing (`?code=&user_state=`) or a hosted sign-in landing in SDK mode
5748
+ * (`?code=&state=`) returns `undefined` and finishes in the background: `SignIn`,
5749
+ * `TwoFactorRequired` or `Error` is the signal. With `deferFederatedLanding` it is left to
5636
5750
  * `completeFederatedLanding()`.
5637
5751
  */
5638
5752
  handleTokensRedirect(): void;
5639
5753
  /**
5640
- * Takes a PKCE federated landing (`?code=&user_state=`) on this page, for an instance built with
5641
- * `deferFederatedLanding`. The code is exchanged in the background; `SignIn` with
5642
- * `source: 'federated-landing'`, `TwoFactorRequired`, or `Error` with operation `federated.redirect`
5643
- * reports the outcome, so subscribe first.
5754
+ * Takes a landing on this page, for an instance built with `deferFederatedLanding`: a PKCE
5755
+ * federated landing (`?code=&user_state=`), else a hosted sign-in landing in SDK mode
5756
+ * (`?code=&state=`). The code is exchanged in the background, so subscribe first:
5757
+ * - federated: `SignIn` with `source: 'federated-landing'`, `TwoFactorRequired`, or `Error` with
5758
+ * operation `federated.redirect`;
5759
+ * - hosted sign-in: `SignIn` with `source: 'oidc-landing'`, or one `Error` with operation
5760
+ * `oidc.redirect` (also for a landing refused here, such as a `state` this tab did not send).
5644
5761
  *
5645
- * @returns true when this tab started that sign-in and the exchange began. On false, neither the
5646
- * URL nor the stored proof key has changed, so an instance that has its app id can still take it.
5762
+ * @returns true when this tab started that sign-in: the URL is cleaned at once and the outcome
5763
+ * arrives by event. On false, neither the URL nor the stored proof key has changed and no event
5764
+ * follows, so an instance that has its app id can still take it.
5647
5765
  */
5648
5766
  completeFederatedLanding(): boolean;
5649
5767
  private checkAndSetTokens;
@@ -5652,6 +5770,8 @@ export declare class Passflow {
5652
5770
  * `redirectto` stay for the login page. A code this tab did not ask for leaves the URL as it is.
5653
5771
  */
5654
5772
  private takeFederatedLanding;
5773
+ /** A hosted sign-in landing in SDK mode (`?code=&state=`); see `completeFederatedLanding()`. */
5774
+ private takeOidcLanding;
5655
5775
  /**
5656
5776
  * Adopts a `#tfa_token=` fragment: the 2FA token goes to the TwoFactorService
5657
5777
  * through `TwoFactorRequired`, exactly as a password sign-in's does, and the
@@ -5662,8 +5782,9 @@ export declare class Passflow {
5662
5782
  private adoptTwoFactorTokenFromUrl;
5663
5783
  private checkErrorsFromURL;
5664
5784
  /**
5665
- * When a token appears in the query or the fragment, removes every token from the query and drops
5666
- * a token-carrying fragment, in one history replace. Other query params stay.
5785
+ * When a token appears in the query or the fragment, removes every token and `client_challenge`
5786
+ * from the query, and the tokens, `client_challenge` and `state` from whichever part carried the
5787
+ * tokens, in one history replace. Other params stay, in the query and in the fragment.
5667
5788
  */
5668
5789
  private cleanupUrlParams;
5669
5790
  private setTokensToCacheFromLocalStorage;
@@ -6105,6 +6226,9 @@ export declare class Passflow {
6105
6226
  /**
6106
6227
  * Get application settings and configuration.
6107
6228
  *
6229
+ * Read once per app id and kept for this instance (sign-in, `authRedirect()` and the URL-token
6230
+ * reader use the same read); a failed read is not kept, so the next call asks again.
6231
+ *
6108
6232
  * @returns Promise with app settings including branding, features, and config
6109
6233
  * @throws {PassflowError} If request fails
6110
6234
  *
@@ -6444,28 +6568,36 @@ export declare class Passflow {
6444
6568
  appId?: string;
6445
6569
  }): string;
6446
6570
  /**
6447
- * Redirect to the Passflow hosted login page.
6571
+ * Redirect to Passflow hosted sign-in, in the app's mode (`pkce_enabled` in its settings).
6572
+ *
6573
+ * - Simple mode (`pkce_enabled` false, or no app id): the `/web` URL of `authRedirectUrl()`.
6574
+ * Hosted sign-in returns tokens in the URL; `options.state` is echoed back with them.
6575
+ * - SDK mode (`pkce_enabled` true): `/oidc/authorize` with PKCE. Hosted sign-in returns an
6576
+ * authorization code, which this SDK redeems on the landing page. `state` is generated here
6577
+ * (`options.state` is not sent), and the default `redirectUrl` is this page's origin and
6578
+ * pathname, so a deep link passes an explicit, registered `redirectUrl`. The app must be a
6579
+ * public client (type SPA).
6580
+ *
6581
+ * Reads the app settings (one read per app id). Every failure emits one `Error` with operation
6582
+ * `auth-redirect` and rejects; nothing navigates then.
6448
6583
  *
6449
6584
  * @param options - Redirect configuration
6450
- * @param options.url - Optional custom Passflow server URL
6451
- * @param options.redirectUrl - URL to redirect to after authentication
6585
+ * @param options.url - Must equal the instance's `url` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
6586
+ * @param options.redirectUrl - URL to return to after authentication
6452
6587
  * @param options.scopes - Optional scopes to request
6453
- * @param options.appId - Optional app ID to use
6588
+ * @param options.appId - Must equal the instance's `appId` when given (`OVERRIDE_NOT_SUPPORTED` otherwise)
6589
+ * @param options.state - Simple mode only: echoed back with the tokens
6590
+ * @throws {PassflowOidcError} `OVERRIDE_NOT_SUPPORTED`, `CONFIDENTIAL_CLIENT`,
6591
+ * `SECURE_CONTEXT_REQUIRED`, `STORAGE_UNAVAILABLE`; or the error of a failed settings read
6454
6592
  *
6455
6593
  * @example
6456
6594
  * ```typescript
6457
- * // Redirect to hosted login page
6458
- * passflow.authRedirect({
6459
- * redirectUrl: window.location.origin + '/auth/callback'
6460
- * });
6595
+ * if (!passflow.isAuthenticated()) {
6596
+ * await passflow.authRedirect({ redirectUrl: window.location.origin + '/auth/callback' });
6597
+ * }
6461
6598
  * ```
6462
6599
  */
6463
- authRedirect(options?: {
6464
- url?: string;
6465
- redirectUrl?: string;
6466
- scopes?: string[];
6467
- appId?: string;
6468
- }): void;
6600
+ authRedirect(options?: AuthRedirectOptions): Promise<void>;
6469
6601
  /**
6470
6602
  * Get the current token delivery mode.
6471
6603
  * Returns the mode determined by the server (json_body, cookie, or mobile).
@@ -6861,4 +6993,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
6861
6993
  * @returns true if valid username format, false otherwise
6862
6994
  */
6863
6995
  export declare function isValidUsername(username: string): boolean;
6864
- export type { AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport };
6996
+ export type { AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport };