@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.
@@ -12,9 +12,10 @@ interface Transaction {
12
12
  export declare class TransactionManager {
13
13
  private storage;
14
14
  private clientId;
15
+ private cookieDomain?;
15
16
  private transaction;
16
17
  private storageKey;
17
- constructor(storage: ClientStorage, clientId: string);
18
+ constructor(storage: ClientStorage, clientId: string, cookieDomain?: string | undefined);
18
19
  create(transaction: Transaction): void;
19
20
  get(): Transaction | undefined;
20
21
  remove(): void;
@@ -1,2 +1,2 @@
1
- declare const _default: "2.0.5";
1
+ declare const _default: "2.0.7";
2
2
  export default _default;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@auth0/auth0-spa-js",
4
4
  "description": "Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE",
5
5
  "license": "MIT",
6
- "version": "2.0.5",
6
+ "version": "2.0.7",
7
7
  "main": "dist/lib/auth0-spa-js.cjs.js",
8
8
  "types": "dist/typings/index.d.ts",
9
9
  "module": "dist/auth0-spa-js.production.esm.js",
@@ -207,7 +207,8 @@ export class Auth0Client {
207
207
 
208
208
  this.transactionManager = new TransactionManager(
209
209
  transactionStorage,
210
- this.options.clientId
210
+ this.options.clientId,
211
+ this.options.cookieDomain,
211
212
  );
212
213
 
213
214
  this.nowProvider = this.options.nowProvider || DEFAULT_NOW_PROVIDER;
@@ -379,7 +380,7 @@ export class Auth0Client {
379
380
  });
380
381
 
381
382
  if (params.state !== codeResult.state) {
382
- throw new Error('Invalid state');
383
+ throw new GenericError('state_mismatch', 'Invalid state');
383
384
  }
384
385
 
385
386
  const organizationId =
@@ -898,7 +899,7 @@ export class Auth0Client {
898
899
  const codeResult = await runIframe(url, this.domainUrl, authorizeTimeout);
899
900
 
900
901
  if (stateIn !== codeResult.state) {
901
- throw new Error('Invalid state');
902
+ throw new GenericError('state_mismatch', 'Invalid state');
902
903
  }
903
904
 
904
905
  const tokenResult = await this._requestToken(
@@ -17,7 +17,7 @@ export class TransactionManager {
17
17
  private transaction: Transaction | undefined;
18
18
  private storageKey: string;
19
19
 
20
- constructor(private storage: ClientStorage, private clientId: string) {
20
+ constructor(private storage: ClientStorage, private clientId: string, private cookieDomain?: string) {
21
21
  this.storageKey = `${TRANSACTION_STORAGE_KEY_PREFIX}.${this.clientId}`;
22
22
  this.transaction = this.storage.get(this.storageKey);
23
23
  }
@@ -26,7 +26,8 @@ export class TransactionManager {
26
26
  this.transaction = transaction;
27
27
 
28
28
  this.storage.save(this.storageKey, transaction, {
29
- daysUntilExpire: 1
29
+ daysUntilExpire: 1,
30
+ cookieDomain: this.cookieDomain,
30
31
  });
31
32
  }
32
33
 
@@ -36,6 +37,8 @@ export class TransactionManager {
36
37
 
37
38
  public remove() {
38
39
  delete this.transaction;
39
- this.storage.remove(this.storageKey);
40
+ this.storage.remove(this.storageKey, {
41
+ cookieDomain: this.cookieDomain
42
+ });
40
43
  }
41
44
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '2.0.5';
1
+ export default '2.0.7';