@auth0/auth0-spa-js 2.2.0 → 2.3.0
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 +1 -1
- package/dist/auth0-spa-js.development.js +16 -4
- 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 +16 -4
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +4 -4
- package/dist/typings/TokenExchange.d.ts +3 -2
- package/dist/typings/global.d.ts +2 -0
- package/dist/typings/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Auth0Client.ts +14 -6
- package/src/TokenExchange.ts +3 -2
- package/src/api.ts +11 -2
- package/src/global.ts +2 -0
- package/src/version.ts +1 -1
|
@@ -550,7 +550,7 @@ var browserTabsLock = createCommonjsModule((function(module, exports) {
|
|
|
550
550
|
|
|
551
551
|
var Lock = unwrapExports(browserTabsLock);
|
|
552
552
|
|
|
553
|
-
var version = "2.
|
|
553
|
+
var version = "2.3.0";
|
|
554
554
|
|
|
555
555
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
556
556
|
|
|
@@ -896,7 +896,13 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
896
896
|
|
|
897
897
|
async function oauthToken(_a, worker) {
|
|
898
898
|
var {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData} = _a, options = __rest(_a, [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData" ]);
|
|
899
|
-
const
|
|
899
|
+
const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
900
|
+
const allParams = Object.assign(Object.assign(Object.assign({}, options), isTokenExchange && audience && {
|
|
901
|
+
audience: audience
|
|
902
|
+
}), isTokenExchange && scope && {
|
|
903
|
+
scope: scope
|
|
904
|
+
});
|
|
905
|
+
const body = useFormData ? createQueryParams(allParams) : JSON.stringify(allParams);
|
|
900
906
|
return await getJSON(`${baseUrl}/oauth/token`, timeout, audience || "default", scope, {
|
|
901
907
|
method: "POST",
|
|
902
908
|
body: body,
|
|
@@ -1920,7 +1926,13 @@ class Auth0Client {
|
|
|
1920
1926
|
throw new GenericError("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
|
|
1921
1927
|
}
|
|
1922
1928
|
const authorizeTimeout = options.timeoutInSeconds || this.options.authorizeTimeoutInSeconds;
|
|
1923
|
-
|
|
1929
|
+
let eventOrigin;
|
|
1930
|
+
try {
|
|
1931
|
+
eventOrigin = new URL(this.domainUrl).origin;
|
|
1932
|
+
} catch (_a) {
|
|
1933
|
+
eventOrigin = this.domainUrl;
|
|
1934
|
+
}
|
|
1935
|
+
const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
|
|
1924
1936
|
if (stateIn !== codeResult.state) {
|
|
1925
1937
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
1926
1938
|
}
|
|
@@ -2058,7 +2070,7 @@ class Auth0Client {
|
|
|
2058
2070
|
subject_token: options.subject_token,
|
|
2059
2071
|
subject_token_type: options.subject_token_type,
|
|
2060
2072
|
scope: getUniqueScopes(options.scope, this.scope),
|
|
2061
|
-
audience: this.options.authorizationParams.audience
|
|
2073
|
+
audience: options.audience || this.options.authorizationParams.audience
|
|
2062
2074
|
});
|
|
2063
2075
|
}
|
|
2064
2076
|
}
|