@auth0/auth0-spa-js 2.10.0 → 2.11.1

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.10/auth0-spa-js.production.js"></script>
33
+ <script src="https://cdn.auth0.com/js/auth0-spa-js/2.11/auth0-spa-js.production.js"></script>
34
34
  ```
35
35
 
36
36
  ### Configure Auth0
@@ -540,7 +540,7 @@
540
540
  exports.default = SuperTokensLock;
541
541
  }));
542
542
  var Lock = unwrapExports(browserTabsLock);
543
- var version = "2.10.0";
543
+ var version = "2.11.1";
544
544
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
545
545
  const DEFAULT_POPUP_CONFIG_OPTIONS = {
546
546
  timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
@@ -2808,6 +2808,7 @@
2808
2808
  }
2809
2809
  }
2810
2810
  async _requestToken(options, additionalParameters) {
2811
+ var _a, _b;
2811
2812
  const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
2812
2813
  const authResult = await oauthToken(Object.assign(Object.assign({
2813
2814
  baseUrl: this.domainUrl,
@@ -2821,6 +2822,13 @@
2821
2822
  scope: scopesToRequest || options.scope
2822
2823
  }), this.worker);
2823
2824
  const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
2825
+ if (options.grant_type === "authorization_code") {
2826
+ const existingIdToken = await this._getIdTokenFromCache();
2827
+ 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) {
2828
+ await this.cacheManager.clear(this.options.clientId);
2829
+ this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
2830
+ }
2831
+ }
2824
2832
  await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, authResult), {
2825
2833
  decodedToken: decodedToken,
2826
2834
  scope: options.scope,
@@ -2845,7 +2853,8 @@
2845
2853
  subject_token: options.subject_token,
2846
2854
  subject_token_type: options.subject_token_type,
2847
2855
  scope: scopesToRequest(this.scope, options.scope, options.audience || this.options.authorizationParams.audience),
2848
- audience: options.audience || this.options.authorizationParams.audience
2856
+ audience: options.audience || this.options.authorizationParams.audience,
2857
+ organization: options.organization || this.options.authorizationParams.organization
2849
2858
  });
2850
2859
  }
2851
2860
  _assertDpop(dpop) {