@auth0/auth0-spa-js 2.0.1 → 2.0.3
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/dist/auth0-spa-js.development.js +19 -15
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +19 -15
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/global.d.ts +1 -1
- package/dist/typings/utils.d.ts +1 -1
- package/dist/typings/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/Auth0Client.ts +7 -3
- package/src/global.ts +1 -1
- package/src/storage.ts +4 -0
- package/src/utils.ts +11 -14
- package/src/version.ts +1 -1
|
@@ -472,7 +472,7 @@
|
|
|
472
472
|
exports.default = SuperTokensLock;
|
|
473
473
|
}));
|
|
474
474
|
var Lock = unwrapExports(browserTabsLock);
|
|
475
|
-
var version = "2.0.
|
|
475
|
+
var version = "2.0.3";
|
|
476
476
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
477
477
|
const DEFAULT_POPUP_CONFIG_OPTIONS = {
|
|
478
478
|
timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
@@ -547,20 +547,17 @@
|
|
|
547
547
|
function valueOrEmptyString(value, exclude = []) {
|
|
548
548
|
return value && !exclude.includes(value) ? value : "";
|
|
549
549
|
}
|
|
550
|
-
const
|
|
550
|
+
const parseAuthenticationResult = queryString => {
|
|
551
551
|
if (queryString.indexOf("#") > -1) {
|
|
552
|
-
queryString = queryString.
|
|
552
|
+
queryString = queryString.substring(0, queryString.indexOf("#"));
|
|
553
553
|
}
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
parsedQuery.expires_in = parseInt(parsedQuery.expires_in);
|
|
562
|
-
}
|
|
563
|
-
return parsedQuery;
|
|
554
|
+
const searchParams = new URLSearchParams(queryString);
|
|
555
|
+
return {
|
|
556
|
+
state: searchParams.get("state"),
|
|
557
|
+
code: searchParams.get("code") || undefined,
|
|
558
|
+
error: searchParams.get("error") || undefined,
|
|
559
|
+
error_description: searchParams.get("error_description") || undefined
|
|
560
|
+
};
|
|
564
561
|
};
|
|
565
562
|
const runIframe = (authorizeUrl, eventOrigin, timeoutInSeconds = DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS) => new Promise(((res, rej) => {
|
|
566
563
|
const iframe = window.document.createElement("iframe");
|
|
@@ -1247,6 +1244,9 @@
|
|
|
1247
1244
|
if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
|
|
1248
1245
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
1249
1246
|
}
|
|
1247
|
+
if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
|
|
1248
|
+
cookieAttributes.domain = options.cookieDomain;
|
|
1249
|
+
}
|
|
1250
1250
|
esCookie_5(`${LEGACY_PREFIX}${key}`, JSON.stringify(value), cookieAttributes);
|
|
1251
1251
|
CookieStorage.save(key, value, options);
|
|
1252
1252
|
},
|
|
@@ -1557,7 +1557,7 @@
|
|
|
1557
1557
|
if (queryStringFragments.length === 0) {
|
|
1558
1558
|
throw new Error("There are no query params available for parsing.");
|
|
1559
1559
|
}
|
|
1560
|
-
const {state: state, code: code, error: error, error_description: error_description} =
|
|
1560
|
+
const {state: state, code: code, error: error, error_description: error_description} = parseAuthenticationResult(queryStringFragments.join(""));
|
|
1561
1561
|
const transaction = this.transactionManager.get();
|
|
1562
1562
|
if (!transaction) {
|
|
1563
1563
|
throw new Error("Invalid state");
|
|
@@ -1697,7 +1697,11 @@
|
|
|
1697
1697
|
}
|
|
1698
1698
|
async logout(options = {}) {
|
|
1699
1699
|
const _a = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _a, logoutOptions = __rest(_a, [ "openUrl" ]);
|
|
1700
|
-
|
|
1700
|
+
if (options.clientId === null) {
|
|
1701
|
+
await this.cacheManager.clear();
|
|
1702
|
+
} else {
|
|
1703
|
+
await this.cacheManager.clear(options.clientId || this.options.clientId);
|
|
1704
|
+
}
|
|
1701
1705
|
this.cookieStorage.remove(this.orgHintCookieName, {
|
|
1702
1706
|
cookieDomain: this.options.cookieDomain
|
|
1703
1707
|
});
|