@auth0/auth0-spa-js 2.18.0 → 2.18.2
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 +330 -296
- 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/auth0-spa-js.worker.development.js +71 -21
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +353 -316
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +439 -439
- package/dist/typings/Auth0Client.utils.d.ts +90 -90
- package/dist/typings/MyAccountApiClient.d.ts +92 -92
- package/dist/typings/TokenExchange.d.ts +77 -77
- package/dist/typings/api.d.ts +2 -2
- package/dist/typings/cache/cache-localstorage.d.ts +7 -7
- package/dist/typings/cache/cache-manager.d.ts +56 -56
- package/dist/typings/cache/cache-memory.d.ts +4 -4
- package/dist/typings/cache/index.d.ts +4 -4
- package/dist/typings/cache/key-manifest.d.ts +12 -12
- package/dist/typings/cache/shared.d.ts +68 -68
- package/dist/typings/constants.d.ts +58 -58
- package/dist/typings/dpop/dpop.d.ts +17 -17
- package/dist/typings/dpop/storage.d.ts +27 -27
- package/dist/typings/dpop/utils.d.ts +15 -15
- package/dist/typings/errors.d.ts +96 -96
- package/dist/typings/fetcher.d.ts +54 -54
- package/dist/typings/global.d.ts +819 -819
- package/dist/typings/http.d.ts +5 -5
- package/dist/typings/index.d.ts +24 -23
- package/dist/typings/jwt.d.ts +21 -21
- package/dist/typings/lock.d.ts +32 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
- package/dist/typings/mfa/constants.d.ts +23 -23
- package/dist/typings/mfa/errors.d.ts +117 -117
- package/dist/typings/mfa/index.d.ts +4 -4
- package/dist/typings/mfa/types.d.ts +181 -181
- package/dist/typings/mfa/utils.d.ts +23 -23
- package/dist/typings/promise-utils.d.ts +2 -2
- package/dist/typings/scope.d.ts +35 -35
- package/dist/typings/storage.d.ts +26 -26
- package/dist/typings/transaction-manager.d.ts +33 -33
- package/dist/typings/utils.d.ts +36 -36
- package/dist/typings/version.d.ts +2 -2
- package/dist/typings/worker/token.worker.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +15 -15
- package/dist/typings/worker/worker.utils.d.ts +7 -7
- package/package.json +6 -4
- package/src/Auth0Client.ts +10 -7
- package/src/index.ts +6 -3
- package/src/utils.ts +2 -1
- package/src/version.ts +1 -1
package/dist/typings/utils.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { AuthenticationResult, PopupConfigOptions } from './global';
|
|
2
|
-
export declare const parseAuthenticationResult: (queryString: string) => AuthenticationResult;
|
|
3
|
-
export declare const runIframe: (authorizeUrl: string, eventOrigin: string, timeoutInSeconds?: number) => Promise<AuthenticationResult>;
|
|
4
|
-
export declare const openPopup: (url: string) => Window | null;
|
|
5
|
-
export declare const runPopup: (config: PopupConfigOptions) => Promise<AuthenticationResult>;
|
|
6
|
-
export declare const getCrypto: () => Crypto;
|
|
7
|
-
export declare const createRandomString: () => string;
|
|
8
|
-
export declare const encode: (value: string) => string;
|
|
9
|
-
export declare const decode: (value: string) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Strips any property that is not present in ALLOWED_AUTH0CLIENT_PROPERTIES
|
|
12
|
-
* @param auth0Client - The full auth0Client object
|
|
13
|
-
* @param excludeEnv - If true, excludes the 'env' property from the result
|
|
14
|
-
* @returns The stripped auth0Client object
|
|
15
|
-
*/
|
|
16
|
-
export declare const stripAuth0Client: (auth0Client: any, excludeEnv?: boolean) => any;
|
|
17
|
-
export declare const createQueryParams: ({ clientId: client_id, ...params }: any) => string;
|
|
18
|
-
export declare const sha256: (s: string) => Promise<any>;
|
|
19
|
-
export declare const urlDecodeB64: (input: string) => string;
|
|
20
|
-
export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
|
|
21
|
-
export declare const validateCrypto: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* @ignore
|
|
24
|
-
*/
|
|
25
|
-
export declare const getDomain: (domainUrl: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
export declare const getTokenIssuer: (issuer: string | undefined, domainUrl: string) => string;
|
|
30
|
-
export declare const parseNumber: (value: any) => number | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Ponyfill for `Object.fromEntries()`, which is not available until ES2020.
|
|
33
|
-
*
|
|
34
|
-
* When the target of this project reaches ES2020, this can be removed.
|
|
35
|
-
*/
|
|
36
|
-
export declare const fromEntries: <T = any>(iterable: Iterable<[PropertyKey, T]>) => Record<PropertyKey, T>;
|
|
1
|
+
import { AuthenticationResult, PopupConfigOptions } from './global';
|
|
2
|
+
export declare const parseAuthenticationResult: (queryString: string) => AuthenticationResult;
|
|
3
|
+
export declare const runIframe: (authorizeUrl: string, eventOrigin: string, timeoutInSeconds?: number) => Promise<AuthenticationResult>;
|
|
4
|
+
export declare const openPopup: (url: string) => Window | null;
|
|
5
|
+
export declare const runPopup: (config: PopupConfigOptions, eventOrigin: string) => Promise<AuthenticationResult>;
|
|
6
|
+
export declare const getCrypto: () => Crypto;
|
|
7
|
+
export declare const createRandomString: () => string;
|
|
8
|
+
export declare const encode: (value: string) => string;
|
|
9
|
+
export declare const decode: (value: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Strips any property that is not present in ALLOWED_AUTH0CLIENT_PROPERTIES
|
|
12
|
+
* @param auth0Client - The full auth0Client object
|
|
13
|
+
* @param excludeEnv - If true, excludes the 'env' property from the result
|
|
14
|
+
* @returns The stripped auth0Client object
|
|
15
|
+
*/
|
|
16
|
+
export declare const stripAuth0Client: (auth0Client: any, excludeEnv?: boolean) => any;
|
|
17
|
+
export declare const createQueryParams: ({ clientId: client_id, ...params }: any) => string;
|
|
18
|
+
export declare const sha256: (s: string) => Promise<any>;
|
|
19
|
+
export declare const urlDecodeB64: (input: string) => string;
|
|
20
|
+
export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
|
|
21
|
+
export declare const validateCrypto: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export declare const getDomain: (domainUrl: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* @ignore
|
|
28
|
+
*/
|
|
29
|
+
export declare const getTokenIssuer: (issuer: string | undefined, domainUrl: string) => string;
|
|
30
|
+
export declare const parseNumber: (value: any) => number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Ponyfill for `Object.fromEntries()`, which is not available until ES2020.
|
|
33
|
+
*
|
|
34
|
+
* When the target of this project reaches ES2020, this can be removed.
|
|
35
|
+
*/
|
|
36
|
+
export declare const fromEntries: <T = any>(iterable: Iterable<[PropertyKey, T]>) => Record<PropertyKey, T>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.18.
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: "2.18.2";
|
|
2
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { FetchOptions } from '../global';
|
|
2
|
-
/**
|
|
3
|
-
* @ts-ignore
|
|
4
|
-
*/
|
|
5
|
-
export type WorkerRefreshTokenMessage = {
|
|
6
|
-
timeout: number;
|
|
7
|
-
fetchUrl: string;
|
|
8
|
-
fetchOptions: FetchOptions;
|
|
9
|
-
useFormData?: boolean;
|
|
10
|
-
useMrrt?: boolean;
|
|
11
|
-
auth: {
|
|
12
|
-
audience: string;
|
|
13
|
-
scope: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
1
|
+
import { FetchOptions } from '../global';
|
|
2
|
+
/**
|
|
3
|
+
* @ts-ignore
|
|
4
|
+
*/
|
|
5
|
+
export type WorkerRefreshTokenMessage = {
|
|
6
|
+
timeout: number;
|
|
7
|
+
fetchUrl: string;
|
|
8
|
+
fetchOptions: FetchOptions;
|
|
9
|
+
useFormData?: boolean;
|
|
10
|
+
useMrrt?: boolean;
|
|
11
|
+
auth: {
|
|
12
|
+
audience: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WorkerRefreshTokenMessage } from './worker.types';
|
|
2
|
-
/**
|
|
3
|
-
* Sends the specified message to the web worker
|
|
4
|
-
* @param message The message to send
|
|
5
|
-
* @param to The worker to send the message to
|
|
6
|
-
*/
|
|
7
|
-
export declare const sendMessage: (message: WorkerRefreshTokenMessage, to: Worker) => Promise<unknown>;
|
|
1
|
+
import { WorkerRefreshTokenMessage } from './worker.types';
|
|
2
|
+
/**
|
|
3
|
+
* Sends the specified message to the web worker
|
|
4
|
+
* @param message The message to send
|
|
5
|
+
* @param to The worker to send the message to
|
|
6
|
+
*/
|
|
7
|
+
export declare const sendMessage: (message: WorkerRefreshTokenMessage, to: Worker) => Promise<unknown>;
|
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.18.
|
|
6
|
+
"version": "2.18.2",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@auth0/auth0-auth-js": "1.
|
|
26
|
+
"@auth0/auth0-auth-js": "1.6.0",
|
|
27
27
|
"browser-tabs-lock": "1.3.0",
|
|
28
28
|
"dpop": "2.1.1",
|
|
29
29
|
"es-cookie": "1.3.2"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"start": "npm run dev",
|
|
34
34
|
"docs": "typedoc --options ./typedoc.js src",
|
|
35
35
|
"build": "rimraf dist && rollup -m -c --environment NODE_ENV:production && npm run test:es-check",
|
|
36
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
36
37
|
"build:stats": "rimraf dist && rollup -m -c --environment NODE_ENV:production --environment WITH_STATS:true && npm run test:es-check && open bundle-stats/index.html",
|
|
37
38
|
"lint": "eslint --ext .jsx,.js src/",
|
|
38
39
|
"lint:security": "eslint ./src --ext ts --no-eslintrc --config ./.eslintrc.security",
|
|
@@ -50,13 +51,14 @@
|
|
|
50
51
|
"serve:coverage": "serve coverage/lcov-report -n",
|
|
51
52
|
"serve:stats": "serve bundle-stats -n",
|
|
52
53
|
"print-bundle-size": "node ./scripts/print-bundle-size.mjs",
|
|
53
|
-
"prepack": "npm run build && node ./scripts/prepack",
|
|
54
|
+
"prepack": "npm run build && npm run build:types && node ./scripts/prepack",
|
|
54
55
|
"publish:cdn": "ccu --trace"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@auth0/component-cdn-uploader": "^
|
|
58
|
+
"@auth0/component-cdn-uploader": "^3.0.2",
|
|
58
59
|
"@babel/core": "^7.28.5",
|
|
59
60
|
"@babel/preset-env": "^7.28.5",
|
|
61
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
60
62
|
"@rollup/plugin-babel": "^6.1.0",
|
|
61
63
|
"@rollup/plugin-commonjs": "^21.1.0",
|
|
62
64
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
package/src/Auth0Client.ts
CHANGED
|
@@ -524,13 +524,16 @@ export class Auth0Client {
|
|
|
524
524
|
|
|
525
525
|
config.popup.location.href = params.url;
|
|
526
526
|
|
|
527
|
-
const codeResult = await runPopup(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
527
|
+
const codeResult = await runPopup(
|
|
528
|
+
{
|
|
529
|
+
...config,
|
|
530
|
+
timeoutInSeconds:
|
|
531
|
+
config.timeoutInSeconds ||
|
|
532
|
+
this.options.authorizeTimeoutInSeconds ||
|
|
533
|
+
DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
534
|
+
},
|
|
535
|
+
new URL(params.url).origin
|
|
536
|
+
);
|
|
534
537
|
|
|
535
538
|
if (params.state !== codeResult.state) {
|
|
536
539
|
throw new GenericError('state_mismatch', 'Invalid state');
|
package/src/index.ts
CHANGED
|
@@ -58,16 +58,19 @@ export type {
|
|
|
58
58
|
} from './mfa';
|
|
59
59
|
|
|
60
60
|
export {
|
|
61
|
-
ICache,
|
|
62
61
|
LocalStorageCache,
|
|
63
62
|
InMemoryCache,
|
|
63
|
+
CacheKey
|
|
64
|
+
} from './cache';
|
|
65
|
+
|
|
66
|
+
export type {
|
|
67
|
+
ICache,
|
|
64
68
|
Cacheable,
|
|
65
69
|
DecodedToken,
|
|
66
70
|
CacheEntry,
|
|
67
71
|
WrappedCacheEntry,
|
|
68
72
|
KeyManifestEntry,
|
|
69
73
|
MaybePromise,
|
|
70
|
-
CacheKey,
|
|
71
74
|
CacheKeyData
|
|
72
75
|
} from './cache';
|
|
73
76
|
|
|
@@ -79,4 +82,4 @@ export type {
|
|
|
79
82
|
|
|
80
83
|
export { MyAccountApiError } from './MyAccountApiClient';
|
|
81
84
|
|
|
82
|
-
export { CustomTokenExchangeOptions } from './TokenExchange';
|
|
85
|
+
export type { CustomTokenExchangeOptions } from './TokenExchange';
|
package/src/utils.ts
CHANGED
|
@@ -97,7 +97,7 @@ export const openPopup = (url: string) => {
|
|
|
97
97
|
);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export const runPopup = (config: PopupConfigOptions) => {
|
|
100
|
+
export const runPopup = (config: PopupConfigOptions, eventOrigin: string) => {
|
|
101
101
|
return new Promise<AuthenticationResult>((resolve, reject) => {
|
|
102
102
|
let popupEventListener: (e: MessageEvent) => void;
|
|
103
103
|
|
|
@@ -118,6 +118,7 @@ export const runPopup = (config: PopupConfigOptions) => {
|
|
|
118
118
|
}, (config.timeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS) * 1000);
|
|
119
119
|
|
|
120
120
|
popupEventListener = function (e: MessageEvent) {
|
|
121
|
+
if (e.origin !== eventOrigin) return;
|
|
121
122
|
if (!e.data || e.data.type !== 'authorization_response') {
|
|
122
123
|
return;
|
|
123
124
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.18.
|
|
1
|
+
export default '2.18.2';
|