@auth0/auth0-spa-js 2.0.0 → 2.0.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 +3 -3
- package/dist/auth0-spa-js.development.js +18 -10
- 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 +20 -10
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.utils.d.ts +7 -1
- package/dist/typings/errors.d.ts +3 -0
- package/dist/typings/global.d.ts +26 -0
- package/dist/typings/index.d.ts +2 -2
- package/dist/typings/version.d.ts +1 -1
- package/package.json +4 -5
- package/src/Auth0Client.ts +11 -9
- package/src/Auth0Client.utils.ts +22 -1
- package/src/errors.ts +3 -0
- package/src/global.ts +28 -0
- package/src/index.ts +3 -2
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -120,10 +120,10 @@ For other comprehensive examples, see the [EXAMPLES.md](https://github.com/auth0
|
|
|
120
120
|
|
|
121
121
|
Explore API Methods available in auth0-spa-js.
|
|
122
122
|
|
|
123
|
-
- [Configuration Options](https://auth0.github.io/auth0-spa-js/interfaces/
|
|
123
|
+
- [Configuration Options](https://auth0.github.io/auth0-spa-js/interfaces/Auth0ClientOptions.html)
|
|
124
124
|
|
|
125
|
-
- [Auth0Client](https://auth0.github.io/auth0-spa-js/classes/
|
|
126
|
-
- [createAuth0Client](https://auth0.github.io/auth0-spa-js/
|
|
125
|
+
- [Auth0Client](https://auth0.github.io/auth0-spa-js/classes/Auth0Client.html)
|
|
126
|
+
- [createAuth0Client](https://auth0.github.io/auth0-spa-js/functions/createAuth0Client.html)
|
|
127
127
|
|
|
128
128
|
## Feedback
|
|
129
129
|
|
|
@@ -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.1";
|
|
476
476
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
477
477
|
const DEFAULT_POPUP_CONFIG_OPTIONS = {
|
|
478
478
|
timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
@@ -1386,6 +1386,13 @@
|
|
|
1386
1386
|
code_challenge: code_challenge,
|
|
1387
1387
|
code_challenge_method: "S256"
|
|
1388
1388
|
});
|
|
1389
|
+
const patchOpenUrlWithOnRedirect = options => {
|
|
1390
|
+
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = __rest(options, [ "openUrl", "onRedirect" ]);
|
|
1391
|
+
const result = Object.assign(Object.assign({}, originalOptions), {
|
|
1392
|
+
openUrl: openUrl === false || openUrl ? openUrl : onRedirect
|
|
1393
|
+
});
|
|
1394
|
+
return result;
|
|
1395
|
+
};
|
|
1389
1396
|
const lock = new Lock;
|
|
1390
1397
|
class Auth0Client {
|
|
1391
1398
|
constructor(options) {
|
|
@@ -1530,17 +1537,17 @@
|
|
|
1530
1537
|
}
|
|
1531
1538
|
async loginWithRedirect(options = {}) {
|
|
1532
1539
|
var _a;
|
|
1533
|
-
const {
|
|
1540
|
+
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _b, urlOptions = __rest(_b, [ "openUrl", "fragment", "appState" ]);
|
|
1534
1541
|
const organizationId = ((_a = urlOptions.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
|
|
1535
|
-
const
|
|
1542
|
+
const _c = await this._prepareAuthorizeUrl(urlOptions.authorizationParams || {}), {url: url} = _c, transaction = __rest(_c, [ "url" ]);
|
|
1536
1543
|
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, transaction), {
|
|
1537
1544
|
appState: appState
|
|
1538
1545
|
}), organizationId && {
|
|
1539
1546
|
organizationId: organizationId
|
|
1540
1547
|
}));
|
|
1541
1548
|
const urlWithFragment = fragment ? `${url}#${fragment}` : url;
|
|
1542
|
-
if (
|
|
1543
|
-
await
|
|
1549
|
+
if (openUrl) {
|
|
1550
|
+
await openUrl(urlWithFragment);
|
|
1544
1551
|
} else {
|
|
1545
1552
|
window.location.assign(urlWithFragment);
|
|
1546
1553
|
}
|
|
@@ -1689,7 +1696,7 @@
|
|
|
1689
1696
|
return url + federatedQuery;
|
|
1690
1697
|
}
|
|
1691
1698
|
async logout(options = {}) {
|
|
1692
|
-
const {
|
|
1699
|
+
const _a = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _a, logoutOptions = __rest(_a, [ "openUrl" ]);
|
|
1693
1700
|
await this.cacheManager.clear();
|
|
1694
1701
|
this.cookieStorage.remove(this.orgHintCookieName, {
|
|
1695
1702
|
cookieDomain: this.options.cookieDomain
|
|
@@ -1699,9 +1706,9 @@
|
|
|
1699
1706
|
});
|
|
1700
1707
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
1701
1708
|
const url = this._buildLogoutUrl(logoutOptions);
|
|
1702
|
-
if (
|
|
1703
|
-
await
|
|
1704
|
-
} else {
|
|
1709
|
+
if (openUrl) {
|
|
1710
|
+
await openUrl(url);
|
|
1711
|
+
} else if (openUrl !== false) {
|
|
1705
1712
|
window.location.assign(url);
|
|
1706
1713
|
}
|
|
1707
1714
|
}
|
|
@@ -1742,7 +1749,7 @@
|
|
|
1742
1749
|
} catch (e) {
|
|
1743
1750
|
if (e.error === "login_required") {
|
|
1744
1751
|
this.logout({
|
|
1745
|
-
|
|
1752
|
+
openUrl: false
|
|
1746
1753
|
});
|
|
1747
1754
|
}
|
|
1748
1755
|
throw e;
|
|
@@ -1866,6 +1873,7 @@
|
|
|
1866
1873
|
exports.InMemoryCache = InMemoryCache;
|
|
1867
1874
|
exports.LocalStorageCache = LocalStorageCache;
|
|
1868
1875
|
exports.MfaRequiredError = MfaRequiredError;
|
|
1876
|
+
exports.MissingRefreshTokenError = MissingRefreshTokenError;
|
|
1869
1877
|
exports.PopupCancelledError = PopupCancelledError;
|
|
1870
1878
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
1871
1879
|
exports.TimeoutError = TimeoutError;
|