@auth0/auth0-spa-js 2.0.5 → 2.0.7

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.
@@ -472,7 +472,7 @@
472
472
  exports.default = SuperTokensLock;
473
473
  }));
474
474
  var Lock = unwrapExports(browserTabsLock);
475
- var version = "2.0.5";
475
+ var version = "2.0.7";
476
476
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
477
477
  const DEFAULT_POPUP_CONFIG_OPTIONS = {
478
478
  timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
@@ -984,16 +984,18 @@
984
984
  }
985
985
  const TRANSACTION_STORAGE_KEY_PREFIX = "a0.spajs.txs";
986
986
  class TransactionManager {
987
- constructor(storage, clientId) {
987
+ constructor(storage, clientId, cookieDomain) {
988
988
  this.storage = storage;
989
989
  this.clientId = clientId;
990
+ this.cookieDomain = cookieDomain;
990
991
  this.storageKey = `${TRANSACTION_STORAGE_KEY_PREFIX}.${this.clientId}`;
991
992
  this.transaction = this.storage.get(this.storageKey);
992
993
  }
993
994
  create(transaction) {
994
995
  this.transaction = transaction;
995
996
  this.storage.save(this.storageKey, transaction, {
996
- daysUntilExpire: 1
997
+ daysUntilExpire: 1,
998
+ cookieDomain: this.cookieDomain
997
999
  });
998
1000
  }
999
1001
  get() {
@@ -1001,7 +1003,9 @@
1001
1003
  }
1002
1004
  remove() {
1003
1005
  delete this.transaction;
1004
- this.storage.remove(this.storageKey);
1006
+ this.storage.remove(this.storageKey, {
1007
+ cookieDomain: this.cookieDomain
1008
+ });
1005
1009
  }
1006
1010
  }
1007
1011
  const isNumber = n => typeof n === "number";
@@ -1436,7 +1440,7 @@
1436
1440
  this.sessionCheckExpiryDays = options.sessionCheckExpiryDays || DEFAULT_SESSION_CHECK_EXPIRY_DAYS;
1437
1441
  const transactionStorage = options.useCookiesForTransactions ? this.cookieStorage : SessionStorage;
1438
1442
  this.scope = getUniqueScopes("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : "");
1439
- this.transactionManager = new TransactionManager(transactionStorage, this.options.clientId);
1443
+ this.transactionManager = new TransactionManager(transactionStorage, this.options.clientId, this.options.cookieDomain);
1440
1444
  this.nowProvider = this.options.nowProvider || DEFAULT_NOW_PROVIDER;
1441
1445
  this.cacheManager = new CacheManager(cache, !cache.allKeys ? new CacheKeyManifest(cache, this.options.clientId) : undefined, this.nowProvider);
1442
1446
  this.domainUrl = getDomain(this.options.domain);
@@ -1513,7 +1517,7 @@
1513
1517
  timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
1514
1518
  }));
1515
1519
  if (params.state !== codeResult.state) {
1516
- throw new Error("Invalid state");
1520
+ throw new GenericError("state_mismatch", "Invalid state");
1517
1521
  }
1518
1522
  const organizationId = ((_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
1519
1523
  await this._requestToken({
@@ -1737,7 +1741,7 @@
1737
1741
  const authorizeTimeout = options.timeoutInSeconds || this.options.authorizeTimeoutInSeconds;
1738
1742
  const codeResult = await runIframe(url, this.domainUrl, authorizeTimeout);
1739
1743
  if (stateIn !== codeResult.state) {
1740
- throw new Error("Invalid state");
1744
+ throw new GenericError("state_mismatch", "Invalid state");
1741
1745
  }
1742
1746
  const tokenResult = await this._requestToken(Object.assign(Object.assign({}, options.authorizationParams), {
1743
1747
  code_verifier: code_verifier,