@auth0/auth0-spa-js 2.13.1 → 2.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.
@@ -551,7 +551,7 @@ var SuperTokensLock = function() {
551
551
 
552
552
  var _default = browserTabsLock.default = SuperTokensLock;
553
553
 
554
- var version = "2.13.1";
554
+ var version = "2.14.0";
555
555
 
556
556
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
557
557
 
@@ -571,6 +571,8 @@ const MISSING_REFRESH_TOKEN_ERROR_MESSAGE = "Missing Refresh Token";
571
571
 
572
572
  const INVALID_REFRESH_TOKEN_ERROR_MESSAGE = "invalid refresh token";
573
573
 
574
+ const USER_BLOCKED_ERROR_MESSAGE = "user is blocked";
575
+
574
576
  const DEFAULT_SCOPE = "openid profile email";
575
577
 
576
578
  const DEFAULT_SESSION_CHECK_EXPIRY_DAYS = 1;
@@ -8443,8 +8445,16 @@ class Auth0Client {
8443
8445
  audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
8444
8446
  });
8445
8447
  } catch (e) {
8446
- if ((e.message.indexOf(MISSING_REFRESH_TOKEN_ERROR_MESSAGE) > -1 || e.message && e.message.indexOf(INVALID_REFRESH_TOKEN_ERROR_MESSAGE) > -1) && this.options.useRefreshTokensFallback) {
8447
- return await this._getTokenFromIFrame(options);
8448
+ if (e.message) {
8449
+ if (e.message.includes(USER_BLOCKED_ERROR_MESSAGE)) {
8450
+ await this.logout({
8451
+ openUrl: false
8452
+ });
8453
+ throw e;
8454
+ }
8455
+ if ((e.message.includes(MISSING_REFRESH_TOKEN_ERROR_MESSAGE) || e.message.includes(INVALID_REFRESH_TOKEN_ERROR_MESSAGE)) && this.options.useRefreshTokensFallback) {
8456
+ return await this._getTokenFromIFrame(options);
8457
+ }
8448
8458
  }
8449
8459
  if (e instanceof MfaRequiredError) {
8450
8460
  this.mfa.setMFAAuthDetails(e.mfa_token, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, (_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience, e.mfa_requirements);
@@ -8537,7 +8547,7 @@ class Auth0Client {
8537
8547
  decodedToken: decodedToken
8538
8548
  });
8539
8549
  }
8540
- async exchangeToken(options) {
8550
+ async loginWithCustomTokenExchange(options) {
8541
8551
  return this._requestToken(Object.assign(Object.assign({}, options), {
8542
8552
  grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
8543
8553
  subject_token: options.subject_token,
@@ -8547,6 +8557,9 @@ class Auth0Client {
8547
8557
  organization: options.organization || this.options.authorizationParams.organization
8548
8558
  }));
8549
8559
  }
8560
+ async exchangeToken(options) {
8561
+ return this.loginWithCustomTokenExchange(options);
8562
+ }
8550
8563
  _assertDpop(dpop) {
8551
8564
  if (!dpop) {
8552
8565
  throw new Error("`useDpop` option must be enabled before using DPoP.");