@auth0/auth0-spa-js 2.0.2 → 2.0.4

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.
@@ -365,7 +365,7 @@ export interface LogoutUrlOptions {
365
365
  *
366
366
  * [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
367
367
  */
368
- clientId?: string;
368
+ clientId?: string | null;
369
369
  /**
370
370
  * Parameters to pass to the logout endpoint. This can be known parameters defined by Auth0 or custom parameters
371
371
  * you wish to provide.
@@ -1,2 +1,2 @@
1
- declare const _default: "2.0.2";
1
+ declare const _default: "2.0.4";
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.2",
6
+ "version": "2.0.4",
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",
@@ -828,7 +828,11 @@ export class Auth0Client {
828
828
  public async logout(options: LogoutOptions = {}): Promise<void> {
829
829
  const { openUrl, ...logoutOptions } = patchOpenUrlWithOnRedirect(options);
830
830
 
831
- await this.cacheManager.clear();
831
+ if (options.clientId === null) {
832
+ await this.cacheManager.clear();
833
+ } else {
834
+ await this.cacheManager.clear(options.clientId || this.options.clientId);
835
+ }
832
836
 
833
837
  this.cookieStorage.remove(this.orgHintCookieName, {
834
838
  cookieDomain: this.options.cookieDomain
package/src/global.ts CHANGED
@@ -410,7 +410,7 @@ export interface LogoutUrlOptions {
410
410
  *
411
411
  * [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
412
412
  */
413
- clientId?: string;
413
+ clientId?: string | null;
414
414
 
415
415
  /**
416
416
  * Parameters to pass to the logout endpoint. This can be known parameters defined by Auth0 or custom parameters
package/src/http.ts CHANGED
@@ -5,7 +5,11 @@ import {
5
5
 
6
6
  import { sendMessage } from './worker/worker.utils';
7
7
  import { FetchOptions } from './global';
8
- import { GenericError, MfaRequiredError } from './errors';
8
+ import {
9
+ GenericError,
10
+ MfaRequiredError,
11
+ MissingRefreshTokenError
12
+ } from './errors';
9
13
 
10
14
  export const createAbortController = () => new AbortController();
11
15
 
@@ -142,6 +146,10 @@ export async function getJSON<T>(
142
146
  throw new MfaRequiredError(error, errorMessage, data.mfa_token);
143
147
  }
144
148
 
149
+ if (error === 'missing_refresh_token') {
150
+ throw new MissingRefreshTokenError(audience, scope);
151
+ }
152
+
145
153
  throw new GenericError(error || 'request_error', errorMessage);
146
154
  }
147
155
 
package/src/storage.ts CHANGED
@@ -91,6 +91,10 @@ export const CookieStorageWithLegacySameSite = {
91
91
  cookieAttributes.expires = options.daysUntilExpire;
92
92
  }
93
93
 
94
+ if (options?.cookieDomain) {
95
+ cookieAttributes.domain = options.cookieDomain;
96
+ }
97
+
94
98
  Cookies.set(
95
99
  `${LEGACY_PREFIX}${key}`,
96
100
  JSON.stringify(value),
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '2.0.2';
1
+ export default '2.0.4';
@@ -116,6 +116,7 @@ const messageHandler = async ({
116
116
  port.postMessage({
117
117
  ok: false,
118
118
  json: {
119
+ error: error.error,
119
120
  error_description: error.message
120
121
  }
121
122
  });