@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.
package/README.md CHANGED
@@ -30,7 +30,7 @@ npm install @auth0/auth0-spa-js
30
30
  From the CDN:
31
31
 
32
32
  ```html
33
- <script src="https://cdn.auth0.com/js/auth0-spa-js/2.13/auth0-spa-js.production.js"></script>
33
+ <script src="https://cdn.auth0.com/js/auth0-spa-js/2.14/auth0-spa-js.production.js"></script>
34
34
  ```
35
35
 
36
36
  ### Configure Auth0
@@ -529,7 +529,7 @@
529
529
  return SuperTokensLock;
530
530
  }();
531
531
  var _default = browserTabsLock.default = SuperTokensLock;
532
- var version = "2.13.1";
532
+ var version = "2.14.0";
533
533
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
534
534
  const DEFAULT_POPUP_CONFIG_OPTIONS = {
535
535
  timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
@@ -540,6 +540,7 @@
540
540
  const CACHE_LOCATION_MEMORY = "memory";
541
541
  const MISSING_REFRESH_TOKEN_ERROR_MESSAGE = "Missing Refresh Token";
542
542
  const INVALID_REFRESH_TOKEN_ERROR_MESSAGE = "invalid refresh token";
543
+ const USER_BLOCKED_ERROR_MESSAGE = "user is blocked";
543
544
  const DEFAULT_SCOPE = "openid profile email";
544
545
  const DEFAULT_SESSION_CHECK_EXPIRY_DAYS = 1;
545
546
  const DEFAULT_AUTH0_CLIENT = {
@@ -7870,8 +7871,16 @@
7870
7871
  audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
7871
7872
  });
7872
7873
  } catch (e) {
7873
- if ((e.message.indexOf(MISSING_REFRESH_TOKEN_ERROR_MESSAGE) > -1 || e.message && e.message.indexOf(INVALID_REFRESH_TOKEN_ERROR_MESSAGE) > -1) && this.options.useRefreshTokensFallback) {
7874
- return await this._getTokenFromIFrame(options);
7874
+ if (e.message) {
7875
+ if (e.message.includes(USER_BLOCKED_ERROR_MESSAGE)) {
7876
+ await this.logout({
7877
+ openUrl: false
7878
+ });
7879
+ throw e;
7880
+ }
7881
+ if ((e.message.includes(MISSING_REFRESH_TOKEN_ERROR_MESSAGE) || e.message.includes(INVALID_REFRESH_TOKEN_ERROR_MESSAGE)) && this.options.useRefreshTokensFallback) {
7882
+ return await this._getTokenFromIFrame(options);
7883
+ }
7875
7884
  }
7876
7885
  if (e instanceof MfaRequiredError) {
7877
7886
  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);
@@ -7964,7 +7973,7 @@
7964
7973
  decodedToken: decodedToken
7965
7974
  });
7966
7975
  }
7967
- async exchangeToken(options) {
7976
+ async loginWithCustomTokenExchange(options) {
7968
7977
  return this._requestToken(Object.assign(Object.assign({}, options), {
7969
7978
  grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
7970
7979
  subject_token: options.subject_token,
@@ -7974,6 +7983,9 @@
7974
7983
  organization: options.organization || this.options.authorizationParams.organization
7975
7984
  }));
7976
7985
  }
7986
+ async exchangeToken(options) {
7987
+ return this.loginWithCustomTokenExchange(options);
7988
+ }
7977
7989
  _assertDpop(dpop) {
7978
7990
  if (!dpop) {
7979
7991
  throw new Error("`useDpop` option must be enabled before using DPoP.");