@auth0/auth0-spa-js 2.16.0 → 2.17.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.
@@ -18,7 +18,7 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
18
18
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
19
19
  };
20
20
 
21
- var version = "2.16.0";
21
+ var version = "2.17.0";
22
22
 
23
23
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
24
24
 
@@ -40,6 +40,8 @@ const INVALID_REFRESH_TOKEN_ERROR_MESSAGE = "invalid refresh token";
40
40
 
41
41
  const USER_BLOCKED_ERROR_MESSAGE = "user is blocked";
42
42
 
43
+ const MFA_STEP_UP_ERROR_DESCRIPTION = "Multifactor authentication required";
44
+
43
45
  const DEFAULT_SCOPE = "openid profile email";
44
46
 
45
47
  const DEFAULT_SESSION_CHECK_EXPIRY_DAYS = 1;
@@ -8325,7 +8327,10 @@ class Auth0Client {
8325
8327
  }
8326
8328
  }
8327
8329
  _isInteractiveError(error) {
8328
- return error instanceof MfaRequiredError;
8330
+ return error instanceof MfaRequiredError || error instanceof GenericError && this._isIframeMfaError(error);
8331
+ }
8332
+ _isIframeMfaError(error) {
8333
+ return error.error === "login_required" && error.error_description === MFA_STEP_UP_ERROR_DESCRIPTION;
8329
8334
  }
8330
8335
  async _handleInteractiveErrorWithPopup(options) {
8331
8336
  try {
@@ -8450,9 +8455,12 @@ class Auth0Client {
8450
8455
  }));
8451
8456
  } catch (e) {
8452
8457
  if (e.error === "login_required") {
8453
- this.logout({
8454
- openUrl: false
8455
- });
8458
+ const shouldSkipLogoutForMfaStepUp = e instanceof GenericError && this._isIframeMfaError(e) && this.options.interactiveErrorHandler === "popup";
8459
+ if (!shouldSkipLogoutForMfaStepUp) {
8460
+ this.logout({
8461
+ openUrl: false
8462
+ });
8463
+ }
8456
8464
  }
8457
8465
  throw e;
8458
8466
  }