@auth0/auth0-spa-js 2.11.0 → 2.11.2

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.
@@ -540,7 +540,7 @@
540
540
  exports.default = SuperTokensLock;
541
541
  }));
542
542
  var Lock = unwrapExports(browserTabsLock);
543
- var version = "2.11.0";
543
+ var version = "2.11.2";
544
544
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
545
545
  const DEFAULT_POPUP_CONFIG_OPTIONS = {
546
546
  timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
@@ -720,7 +720,9 @@
720
720
  clearTimeout(timeoutId);
721
721
  clearInterval(popupTimer);
722
722
  window.removeEventListener("message", popupEventListener, false);
723
- config.popup.close();
723
+ if (config.closePopup !== false) {
724
+ config.popup.close();
725
+ }
724
726
  if (e.data.response.error) {
725
727
  return reject(GenericError.fromPayload(e.data.response));
726
728
  }
@@ -2808,6 +2810,7 @@
2808
2810
  }
2809
2811
  }
2810
2812
  async _requestToken(options, additionalParameters) {
2813
+ var _a, _b;
2811
2814
  const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
2812
2815
  const authResult = await oauthToken(Object.assign(Object.assign({
2813
2816
  baseUrl: this.domainUrl,
@@ -2821,6 +2824,13 @@
2821
2824
  scope: scopesToRequest || options.scope
2822
2825
  }), this.worker);
2823
2826
  const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
2827
+ if (options.grant_type === "authorization_code") {
2828
+ const existingIdToken = await this._getIdTokenFromCache();
2829
+ if (((_b = (_a = existingIdToken === null || existingIdToken === void 0 ? void 0 : existingIdToken.decodedToken) === null || _a === void 0 ? void 0 : _a.claims) === null || _b === void 0 ? void 0 : _b.sub) && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
2830
+ await this.cacheManager.clear(this.options.clientId);
2831
+ this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
2832
+ }
2833
+ }
2824
2834
  await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, authResult), {
2825
2835
  decodedToken: decodedToken,
2826
2836
  scope: options.scope,