@auth0/auth0-spa-js 1.22.4 → 2.0.0-beta.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 +50 -41
- package/dist/auth0-spa-js.development.js +1000 -4923
- 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 +1734 -5516
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +14 -41
- package/dist/typings/Auth0Client.utils.d.ts +26 -0
- package/dist/typings/cache/cache-manager.d.ts +11 -7
- package/dist/typings/cache/shared.d.ts +16 -11
- package/dist/typings/constants.d.ts +0 -7
- package/dist/typings/errors.d.ts +0 -4
- package/dist/typings/global.d.ts +125 -167
- package/dist/typings/index.d.ts +3 -13
- package/dist/typings/transaction-manager.d.ts +1 -1
- package/dist/typings/utils.d.ts +8 -7
- package/dist/typings/version.d.ts +1 -1
- package/package.json +35 -36
- package/src/Auth0Client.ts +385 -561
- package/src/Auth0Client.utils.ts +73 -0
- package/src/cache/cache-localstorage.ts +1 -1
- package/src/cache/cache-manager.ts +58 -29
- package/src/cache/shared.ts +29 -17
- package/src/constants.ts +0 -17
- package/src/errors.ts +10 -14
- package/src/global.ts +132 -183
- package/src/http.ts +0 -5
- package/src/index.ts +15 -14
- package/src/jwt.ts +3 -3
- package/src/storage.ts +1 -1
- package/src/transaction-manager.ts +1 -1
- package/src/utils.ts +37 -42
- package/src/version.ts +1 -1
- package/src/worker/token.worker.ts +4 -3
- package/dist/typings/index.cjs.d.ts +0 -5
- package/dist/typings/user-agent.d.ts +0 -1
- package/src/index.cjs.ts +0 -23
- package/src/user-agent.ts +0 -1
package/dist/typings/global.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { ICache } from './cache';
|
|
2
|
-
|
|
3
|
-
* @ignore
|
|
4
|
-
*/
|
|
5
|
-
export interface BaseLoginOptions {
|
|
2
|
+
export interface AuthorizationParams {
|
|
6
3
|
/**
|
|
7
4
|
* - `'page'`: displays the UI with a full page view
|
|
8
5
|
* - `'popup'`: displays the UI with a popup window
|
|
@@ -18,7 +15,7 @@ export interface BaseLoginOptions {
|
|
|
18
15
|
*/
|
|
19
16
|
prompt?: 'none' | 'login' | 'consent' | 'select_account';
|
|
20
17
|
/**
|
|
21
|
-
* Maximum allowable
|
|
18
|
+
* Maximum allowable elapsed time (in seconds) since authentication.
|
|
22
19
|
* If the last time the user authenticated is greater than this value,
|
|
23
20
|
* the user must be reauthenticated.
|
|
24
21
|
*/
|
|
@@ -51,8 +48,11 @@ export interface BaseLoginOptions {
|
|
|
51
48
|
acr_values?: string;
|
|
52
49
|
/**
|
|
53
50
|
* The default scope to be used on authentication requests.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
51
|
+
*
|
|
52
|
+
* This defaults to `profile email` if not set. If you are setting extra scopes and require
|
|
53
|
+
* `profile` and `email` to be included then you must include them in the provided scope.
|
|
54
|
+
*
|
|
55
|
+
* Note: The `openid` scope is **always applied** regardless of this setting.
|
|
56
56
|
*/
|
|
57
57
|
scope?: string;
|
|
58
58
|
/**
|
|
@@ -76,20 +76,26 @@ export interface BaseLoginOptions {
|
|
|
76
76
|
* The Id of an invitation to accept. This is available from the user invitation URL that is given when participating in a user invitation flow.
|
|
77
77
|
*/
|
|
78
78
|
invitation?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The default URL where Auth0 will redirect your browser to with
|
|
81
|
+
* the authentication result. It must be whitelisted in
|
|
82
|
+
* the "Allowed Callback URLs" field in your Auth0 Application's
|
|
83
|
+
* settings. If not provided here, it should be provided in the other
|
|
84
|
+
* methods that provide authentication.
|
|
85
|
+
*/
|
|
86
|
+
redirect_uri?: string;
|
|
79
87
|
/**
|
|
80
88
|
* If you need to send custom parameters to the Authorization Server,
|
|
81
89
|
* make sure to use the original parameter name.
|
|
82
90
|
*/
|
|
83
91
|
[key: string]: any;
|
|
84
92
|
}
|
|
85
|
-
interface
|
|
93
|
+
interface BaseLoginOptions {
|
|
86
94
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* Note: The `openid` scope is **always applied** regardless of this setting.
|
|
95
|
+
* URL parameters that will be sent back to the Authorization Server. This can be known parameters
|
|
96
|
+
* defined by Auth0 or custom parameters that you define.
|
|
91
97
|
*/
|
|
92
|
-
|
|
98
|
+
authorizationParams?: AuthorizationParams;
|
|
93
99
|
}
|
|
94
100
|
export interface Auth0ClientOptions extends BaseLoginOptions {
|
|
95
101
|
/**
|
|
@@ -105,15 +111,7 @@ export interface Auth0ClientOptions extends BaseLoginOptions {
|
|
|
105
111
|
/**
|
|
106
112
|
* The Client ID found on your Application settings page
|
|
107
113
|
*/
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The default URL where Auth0 will redirect your browser to with
|
|
111
|
-
* the authentication result. It must be whitelisted in
|
|
112
|
-
* the "Allowed Callback URLs" field in your Auth0 Application's
|
|
113
|
-
* settings. If not provided here, it should be provided in the other
|
|
114
|
-
* methods that provide authentication.
|
|
115
|
-
*/
|
|
116
|
-
redirect_uri?: string;
|
|
114
|
+
clientId: string;
|
|
117
115
|
/**
|
|
118
116
|
* The value in seconds used to account for clock skew in JWT expirations.
|
|
119
117
|
* Typically, this value is no more than a minute or two at maximum.
|
|
@@ -139,23 +137,24 @@ export interface Auth0ClientOptions extends BaseLoginOptions {
|
|
|
139
137
|
*/
|
|
140
138
|
useRefreshTokens?: boolean;
|
|
141
139
|
/**
|
|
142
|
-
* If true, fallback to the technique of using a hidden iframe and the `authorization_code` grant with `prompt=none` when unable to use refresh tokens.
|
|
143
|
-
* The default setting is `
|
|
140
|
+
* If true, fallback to the technique of using a hidden iframe and the `authorization_code` grant with `prompt=none` when unable to use refresh tokens. If false, the iframe fallback is not used and
|
|
141
|
+
* errors relating to a failed `refresh_token` grant should be handled appropriately. The default setting is `false`.
|
|
144
142
|
*
|
|
145
143
|
* **Note**: There might be situations where doing silent auth with a Web Message response from an iframe is not possible,
|
|
146
144
|
* like when you're serving your application from the file system or a custom protocol (like in a Desktop or Native app).
|
|
147
|
-
* In situations like this you can disable the iframe fallback and handle the failed
|
|
145
|
+
* In situations like this you can disable the iframe fallback and handle the failed `refresh_token` grant and prompt the user to login interactively with `loginWithRedirect` or `loginWithPopup`."
|
|
148
146
|
*
|
|
149
147
|
* E.g. Using the `file:` protocol in an Electron application does not support that legacy technique.
|
|
150
148
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
149
|
+
* @example
|
|
150
|
+
* let token: string;
|
|
151
|
+
* try {
|
|
152
|
+
* token = await auth0.getTokenSilently();
|
|
153
|
+
* } catch (e) {
|
|
154
|
+
* if (e.error === 'missing_refresh_token' || e.error === 'invalid_grant') {
|
|
155
|
+
* auth0.loginWithRedirect();
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
159
158
|
*/
|
|
160
159
|
useRefreshTokensFallback?: boolean;
|
|
161
160
|
/**
|
|
@@ -199,10 +198,6 @@ export interface Auth0ClientOptions extends BaseLoginOptions {
|
|
|
199
198
|
* may end up spanning across multiple tabs (e.g. magic links) or you cannot otherwise rely on session storage being available.
|
|
200
199
|
*/
|
|
201
200
|
useCookiesForTransactions?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Changes to recommended defaults, like defaultScope
|
|
204
|
-
*/
|
|
205
|
-
advancedOptions?: AdvancedOptions;
|
|
206
201
|
/**
|
|
207
202
|
* Number of days until the cookie `auth0.is.authenticated` will expire
|
|
208
203
|
* Defaults to 1.
|
|
@@ -221,11 +216,10 @@ export interface Auth0ClientOptions extends BaseLoginOptions {
|
|
|
221
216
|
*/
|
|
222
217
|
cookieDomain?: string;
|
|
223
218
|
/**
|
|
224
|
-
*
|
|
225
|
-
* future major version.
|
|
219
|
+
* If true, data to the token endpoint is transmitted as x-www-form-urlencoded data, if false it will be transmitted as JSON. The default setting is `true`.
|
|
226
220
|
*
|
|
227
|
-
* **Note:** Setting this to `
|
|
228
|
-
* continue to work as intended.
|
|
221
|
+
* **Note:** Setting this to `false` may affect you if you use Auth0 Rules and are sending custom, non-primitive data. If you disable this,
|
|
222
|
+
* please verify that your Auth0 Rules continue to work as intended.
|
|
229
223
|
*/
|
|
230
224
|
useFormData?: boolean;
|
|
231
225
|
/**
|
|
@@ -242,7 +236,7 @@ export declare type CacheLocation = 'memory' | 'localstorage';
|
|
|
242
236
|
/**
|
|
243
237
|
* @ignore
|
|
244
238
|
*/
|
|
245
|
-
export interface AuthorizeOptions extends
|
|
239
|
+
export interface AuthorizeOptions extends AuthorizationParams {
|
|
246
240
|
response_type: string;
|
|
247
241
|
response_mode: string;
|
|
248
242
|
redirect_uri: string;
|
|
@@ -253,13 +247,6 @@ export interface AuthorizeOptions extends BaseLoginOptions {
|
|
|
253
247
|
code_challenge_method: string;
|
|
254
248
|
}
|
|
255
249
|
export interface RedirectLoginOptions<TAppState = any> extends BaseLoginOptions {
|
|
256
|
-
/**
|
|
257
|
-
* The URL where Auth0 will redirect your browser to with
|
|
258
|
-
* the authentication result. It must be whitelisted in
|
|
259
|
-
* the "Allowed Callback URLs" field in your Auth0 Application's
|
|
260
|
-
* settings.
|
|
261
|
-
*/
|
|
262
|
-
redirect_uri?: string;
|
|
263
250
|
/**
|
|
264
251
|
* Used to store state before doing the redirect
|
|
265
252
|
*/
|
|
@@ -269,9 +256,16 @@ export interface RedirectLoginOptions<TAppState = any> extends BaseLoginOptions
|
|
|
269
256
|
*/
|
|
270
257
|
fragment?: string;
|
|
271
258
|
/**
|
|
272
|
-
* Used to
|
|
273
|
-
|
|
274
|
-
|
|
259
|
+
* Used to control the redirect and not rely on the SDK to do the actual redirect.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const client = new Auth0Client({
|
|
263
|
+
* async onRedirect(url) {
|
|
264
|
+
* window.location.replace(url);
|
|
265
|
+
* }
|
|
266
|
+
* });
|
|
267
|
+
*/
|
|
268
|
+
onRedirect?: (url: string) => Promise<void>;
|
|
275
269
|
}
|
|
276
270
|
export interface RedirectLoginResult<TAppState = any> {
|
|
277
271
|
/**
|
|
@@ -294,50 +288,41 @@ export interface PopupConfigOptions {
|
|
|
294
288
|
*/
|
|
295
289
|
popup?: any;
|
|
296
290
|
}
|
|
297
|
-
export interface GetUserOptions {
|
|
298
|
-
/**
|
|
299
|
-
* The scope that was used in the authentication request
|
|
300
|
-
*/
|
|
301
|
-
scope?: string;
|
|
302
|
-
/**
|
|
303
|
-
* The audience that was used in the authentication request
|
|
304
|
-
*/
|
|
305
|
-
audience?: string;
|
|
306
|
-
}
|
|
307
|
-
export interface GetIdTokenClaimsOptions {
|
|
308
|
-
/**
|
|
309
|
-
* The scope that was used in the authentication request
|
|
310
|
-
*/
|
|
311
|
-
scope?: string;
|
|
312
|
-
/**
|
|
313
|
-
* The audience that was used in the authentication request
|
|
314
|
-
*/
|
|
315
|
-
audience?: string;
|
|
316
|
-
}
|
|
317
|
-
export declare type getIdTokenClaimsOptions = GetIdTokenClaimsOptions;
|
|
318
291
|
export interface GetTokenSilentlyOptions {
|
|
319
292
|
/**
|
|
320
|
-
* When `
|
|
293
|
+
* When `off`, ignores the cache and always sends a
|
|
321
294
|
* request to Auth0.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
295
|
+
* When `cache-only`, only reads from the cache and never sends a request to Auth0.
|
|
296
|
+
* Defaults to `on`, where it both reads from the cache and sends a request to Auth0 as needed.
|
|
297
|
+
*/
|
|
298
|
+
cacheMode?: 'on' | 'off' | 'cache-only';
|
|
299
|
+
/**
|
|
300
|
+
* Parameters that will be sent back to Auth0 as part of a request.
|
|
301
|
+
*/
|
|
302
|
+
authorizationParams?: {
|
|
303
|
+
/**
|
|
304
|
+
* There's no actual redirect when getting a token silently,
|
|
305
|
+
* but, according to the spec, a `redirect_uri` param is required.
|
|
306
|
+
* Auth0 uses this parameter to validate that the current `origin`
|
|
307
|
+
* matches the `redirect_uri` `origin` when sending the response.
|
|
308
|
+
* It must be whitelisted in the "Allowed Web Origins" in your
|
|
309
|
+
* Auth0 Application's settings.
|
|
310
|
+
*/
|
|
311
|
+
redirect_uri?: string;
|
|
312
|
+
/**
|
|
313
|
+
* The scope that was used in the authentication request
|
|
314
|
+
*/
|
|
315
|
+
scope?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The audience that was used in the authentication request
|
|
318
|
+
*/
|
|
319
|
+
audience?: string;
|
|
320
|
+
/**
|
|
321
|
+
* If you need to send custom parameters to the Authorization Server,
|
|
322
|
+
* make sure to use the original parameter name.
|
|
323
|
+
*/
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
};
|
|
341
326
|
/** A maximum number of seconds to wait before declaring the background /authorize call as failed for timeout
|
|
342
327
|
* Defaults to 60s.
|
|
343
328
|
*/
|
|
@@ -349,90 +334,69 @@ export interface GetTokenSilentlyOptions {
|
|
|
349
334
|
* The default is `false`.
|
|
350
335
|
*/
|
|
351
336
|
detailedResponse?: boolean;
|
|
352
|
-
/**
|
|
353
|
-
* If you need to send custom parameters to the Authorization Server,
|
|
354
|
-
* make sure to use the original parameter name.
|
|
355
|
-
*/
|
|
356
|
-
[key: string]: any;
|
|
357
337
|
}
|
|
358
338
|
export interface GetTokenWithPopupOptions extends PopupLoginOptions {
|
|
359
339
|
/**
|
|
360
|
-
* When `
|
|
361
|
-
* request to Auth0.
|
|
340
|
+
* When `off`, ignores the cache and always sends a request to Auth0.
|
|
341
|
+
* When `cache-only`, only reads from the cache and never sends a request to Auth0.
|
|
342
|
+
* Defaults to `on`, where it both reads from the cache and sends a request to Auth0 as needed.
|
|
362
343
|
*/
|
|
363
|
-
|
|
344
|
+
cacheMode?: 'on' | 'off' | 'cache-only';
|
|
364
345
|
}
|
|
365
346
|
export interface LogoutUrlOptions {
|
|
366
347
|
/**
|
|
367
|
-
* The
|
|
368
|
-
*
|
|
369
|
-
* **Note**: If the `client_id` parameter is included, the
|
|
370
|
-
* `returnTo` URL that is provided must be listed in the
|
|
371
|
-
* Application's "Allowed Logout URLs" in the Auth0 dashboard.
|
|
372
|
-
* However, if the `client_id` parameter is not included, the
|
|
373
|
-
* `returnTo` URL must be listed in the "Allowed Logout URLs" at
|
|
374
|
-
* the account level in the Auth0 dashboard.
|
|
375
|
-
*
|
|
376
|
-
* [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
|
|
377
|
-
*/
|
|
378
|
-
returnTo?: string;
|
|
379
|
-
/**
|
|
380
|
-
* The `client_id` of your application.
|
|
348
|
+
* The `clientId` of your application.
|
|
381
349
|
*
|
|
382
|
-
* If this property is not set, then the `
|
|
350
|
+
* If this property is not set, then the `clientId` that was used during initialization of the SDK is sent to the logout endpoint.
|
|
383
351
|
*
|
|
384
352
|
* If this property is set to `null`, then no client ID value is sent to the logout endpoint.
|
|
385
353
|
*
|
|
386
354
|
* [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
|
|
387
355
|
*/
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
356
|
+
clientId?: string;
|
|
357
|
+
/**
|
|
358
|
+
* Parameters to pass to the logout endpoint. This can be known parameters defined by Auth0 or custom parameters
|
|
359
|
+
* you wish to provide.
|
|
360
|
+
*/
|
|
361
|
+
logoutParams?: {
|
|
362
|
+
/**
|
|
363
|
+
* When supported by the upstream identity provider,
|
|
364
|
+
* forces the user to logout of their identity provider
|
|
365
|
+
* and from Auth0.
|
|
366
|
+
* [Read more about how federated logout works at Auth0](https://auth0.com/docs/logout/guides/logout-idps)
|
|
367
|
+
*/
|
|
368
|
+
federated?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* The URL where Auth0 will redirect your browser to after the logout.
|
|
371
|
+
*
|
|
372
|
+
* **Note**: If the `client_id` parameter is included, the
|
|
373
|
+
* `returnTo` URL that is provided must be listed in the
|
|
374
|
+
* Application's "Allowed Logout URLs" in the Auth0 dashboard.
|
|
375
|
+
* However, if the `client_id` parameter is not included, the
|
|
376
|
+
* `returnTo` URL must be listed in the "Allowed Logout URLs" at
|
|
377
|
+
* the account level in the Auth0 dashboard.
|
|
378
|
+
*
|
|
379
|
+
* [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
|
|
380
|
+
*/
|
|
381
|
+
returnTo?: string;
|
|
382
|
+
/**
|
|
383
|
+
* If you need to send custom parameters to the logout endpoint, make sure to use the original parameter name.
|
|
384
|
+
*/
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
};
|
|
396
387
|
}
|
|
397
|
-
export interface LogoutOptions {
|
|
398
|
-
/**
|
|
399
|
-
* The URL where Auth0 will redirect your browser to after the logout.
|
|
400
|
-
*
|
|
401
|
-
* **Note**: If the `client_id` parameter is included, the
|
|
402
|
-
* `returnTo` URL that is provided must be listed in the
|
|
403
|
-
* Application's "Allowed Logout URLs" in the Auth0 dashboard.
|
|
404
|
-
* However, if the `client_id` parameter is not included, the
|
|
405
|
-
* `returnTo` URL must be listed in the "Allowed Logout URLs" at
|
|
406
|
-
* the account level in the Auth0 dashboard.
|
|
407
|
-
*
|
|
408
|
-
* [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
|
|
409
|
-
*/
|
|
410
|
-
returnTo?: string;
|
|
388
|
+
export interface LogoutOptions extends LogoutUrlOptions {
|
|
411
389
|
/**
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
* If this property is not set, then the `client_id` that was used during initialization of the SDK is sent to the logout endpoint.
|
|
390
|
+
* Used to control the redirect and not rely on the SDK to do the actual redirect.
|
|
415
391
|
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
* and from Auth0.
|
|
425
|
-
* This option cannot be specified along with the `localOnly` option.
|
|
426
|
-
* [Read more about how federated logout works at Auth0](https://auth0.com/docs/logout/guides/logout-idps)
|
|
427
|
-
*/
|
|
428
|
-
federated?: boolean;
|
|
429
|
-
/**
|
|
430
|
-
* When `true`, this skips the request to the logout endpoint on the authorization server,
|
|
431
|
-
* effectively performing a "local" logout of the application. No redirect should take place,
|
|
432
|
-
* you should update local logged in state.
|
|
433
|
-
* This option cannot be specified along with the `federated` option.
|
|
434
|
-
*/
|
|
435
|
-
localOnly?: boolean;
|
|
392
|
+
* @example
|
|
393
|
+
* await auth0.logout({
|
|
394
|
+
* async onRedirect(url) {
|
|
395
|
+
* window.location.replace(url);
|
|
396
|
+
* }
|
|
397
|
+
* });
|
|
398
|
+
*/
|
|
399
|
+
onRedirect?: (url: string) => Promise<void>;
|
|
436
400
|
}
|
|
437
401
|
/**
|
|
438
402
|
* @ignore
|
|
@@ -455,9 +419,6 @@ export interface TokenEndpointOptions {
|
|
|
455
419
|
useFormData?: boolean;
|
|
456
420
|
[key: string]: any;
|
|
457
421
|
}
|
|
458
|
-
/**
|
|
459
|
-
* @ignore
|
|
460
|
-
*/
|
|
461
422
|
export declare type TokenEndpointResponse = {
|
|
462
423
|
id_token: string;
|
|
463
424
|
access_token: string;
|
|
@@ -494,9 +455,6 @@ export interface JWTVerifyOptions {
|
|
|
494
455
|
organizationId?: string;
|
|
495
456
|
now?: number;
|
|
496
457
|
}
|
|
497
|
-
/**
|
|
498
|
-
* @ignore
|
|
499
|
-
*/
|
|
500
458
|
export interface IdToken {
|
|
501
459
|
__raw: string;
|
|
502
460
|
name?: string;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import 'core-js/es/symbol';
|
|
3
|
-
import 'core-js/es/array/from';
|
|
4
|
-
import 'core-js/es/typed-array/slice';
|
|
5
|
-
import 'core-js/es/array/includes';
|
|
6
|
-
import 'core-js/es/string/includes';
|
|
7
|
-
import 'core-js/es/set';
|
|
8
|
-
import 'promise-polyfill/src/polyfill';
|
|
9
|
-
import 'fast-text-encoding';
|
|
10
|
-
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
|
|
11
|
-
import Auth0Client from './Auth0Client';
|
|
1
|
+
import { Auth0Client } from './Auth0Client';
|
|
12
2
|
import { Auth0ClientOptions } from './global';
|
|
13
3
|
import './global';
|
|
14
4
|
export * from './global';
|
|
@@ -21,7 +11,7 @@ export * from './global';
|
|
|
21
11
|
* @param options The client options
|
|
22
12
|
* @returns An instance of Auth0Client
|
|
23
13
|
*/
|
|
24
|
-
export
|
|
14
|
+
export declare function createAuth0Client(options: Auth0ClientOptions): Promise<Auth0Client>;
|
|
25
15
|
export { Auth0Client };
|
|
26
16
|
export { GenericError, AuthenticationError, TimeoutError, PopupTimeoutError, PopupCancelledError, MfaRequiredError } from './errors';
|
|
27
|
-
export { ICache, LocalStorageCache, InMemoryCache, Cacheable } from './cache';
|
|
17
|
+
export { ICache, LocalStorageCache, InMemoryCache, Cacheable, DecodedToken, CacheEntry, WrappedCacheEntry, KeyManifestEntry, MaybePromise, CacheKey, CacheKeyData } from './cache';
|
package/dist/typings/utils.d.ts
CHANGED
|
@@ -4,19 +4,20 @@ export declare const runIframe: (authorizeUrl: string, eventOrigin: string, time
|
|
|
4
4
|
export declare const openPopup: (url: string) => Window;
|
|
5
5
|
export declare const runPopup: (config: PopupConfigOptions) => Promise<AuthenticationResult>;
|
|
6
6
|
export declare const getCrypto: () => Crypto;
|
|
7
|
-
export declare const getCryptoSubtle: () => any;
|
|
8
7
|
export declare const createRandomString: () => string;
|
|
9
8
|
export declare const encode: (value: string) => string;
|
|
10
9
|
export declare const decode: (value: string) => string;
|
|
11
|
-
export declare const createQueryParams: (params: any) => string;
|
|
10
|
+
export declare const createQueryParams: ({ clientId: client_id, ...params }: any) => string;
|
|
12
11
|
export declare const sha256: (s: string) => Promise<any>;
|
|
13
12
|
export declare const urlDecodeB64: (input: string) => string;
|
|
14
13
|
export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
|
|
15
14
|
export declare const validateCrypto: () => void;
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param value The value to check
|
|
19
|
-
* @param exclude An array of values that should result in an empty string.
|
|
20
|
-
* @returns The value, or an empty string when falsy or included in the exclude argument.
|
|
16
|
+
* @ignore
|
|
21
17
|
*/
|
|
22
|
-
export declare
|
|
18
|
+
export declare const getDomain: (domainUrl: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
22
|
+
export declare const getTokenIssuer: (issuer: string, domainUrl: string) => string;
|
|
23
|
+
export declare const parseNumber: (value: any) => number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "
|
|
1
|
+
declare const _default: "2.0.0-beta.0";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -3,60 +3,68 @@
|
|
|
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": "
|
|
6
|
+
"version": "2.0.0-beta.0",
|
|
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",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "rimraf dist && rollup -c --watch",
|
|
12
12
|
"start": "npm run dev",
|
|
13
|
-
"docs": "typedoc --options ./typedoc.js
|
|
13
|
+
"docs": "typedoc --options ./typedoc.js src",
|
|
14
14
|
"build": "rimraf dist && rollup -m -c --environment NODE_ENV:production && npm run test:es-check",
|
|
15
|
-
"build:stats": "
|
|
15
|
+
"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",
|
|
16
16
|
"lint:security": "eslint ./src --ext ts --no-eslintrc --config ./.eslintrc.security",
|
|
17
17
|
"test": "jest --coverage --silent",
|
|
18
18
|
"test:watch": "jest --coverage --watch",
|
|
19
19
|
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
|
|
20
20
|
"test:open:integration": "cypress open",
|
|
21
21
|
"test:watch:integration": "concurrently --raw npm:dev 'npm:test:open:integration'",
|
|
22
|
-
"test:es-check": "npm run test:es-check:
|
|
23
|
-
"test:es-check:
|
|
24
|
-
"test:es-check:
|
|
22
|
+
"test:es-check": "npm run test:es-check:es2017 && npm run test:es-check:es2017:module",
|
|
23
|
+
"test:es-check:es2017": "es-check es2017 'dist/auth0-spa-js.production.js'",
|
|
24
|
+
"test:es-check:es2017:module": "es-check es2017 'dist/auth0-spa-js.production.esm.js' --module ",
|
|
25
25
|
"test:integration:server": "npm run dev",
|
|
26
26
|
"test:integration:tests": "wait-on http://localhost:3000/ && cypress run",
|
|
27
27
|
"test:integration": "concurrently --raw --kill-others --success first npm:test:integration:server npm:test:integration:tests",
|
|
28
28
|
"serve:coverage": "serve coverage/lcov-report -n",
|
|
29
29
|
"serve:stats": "serve bundle-stats -n",
|
|
30
|
-
"print-bundle-size": "node ./scripts/print-bundle-size",
|
|
30
|
+
"print-bundle-size": "node ./scripts/print-bundle-size.mjs",
|
|
31
31
|
"prepack": "npm run build && node ./scripts/prepack",
|
|
32
32
|
"publish:cdn": "ccu --trace"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@auth0/component-cdn-uploader": "github:auth0/component-cdn-uploader#v2.2.2",
|
|
36
|
-
"@
|
|
36
|
+
"@babel/core": "^7.18.13",
|
|
37
|
+
"@babel/preset-env": "^7.18.10",
|
|
38
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
37
39
|
"@types/cypress": "^1.1.3",
|
|
38
|
-
"@types/jest": "^
|
|
39
|
-
"@typescript-eslint/eslint-plugin-tslint": "^
|
|
40
|
-
"@typescript-eslint/parser": "^
|
|
40
|
+
"@types/jest": "^28.1.7",
|
|
41
|
+
"@typescript-eslint/eslint-plugin-tslint": "^5.33.1",
|
|
42
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
43
|
+
"babel-jest": "^28.1.3",
|
|
41
44
|
"browserstack-cypress-cli": "1.8.1",
|
|
45
|
+
"browser-tabs-lock": "^1.2.15",
|
|
42
46
|
"cli-table": "^0.3.6",
|
|
43
|
-
"concurrently": "^
|
|
47
|
+
"concurrently": "^7.3.0",
|
|
44
48
|
"cypress": "7.2.0",
|
|
45
|
-
"es-check": "^
|
|
46
|
-
"
|
|
47
|
-
"
|
|
49
|
+
"es-check": "^7.0.0",
|
|
50
|
+
"es-cookie": "~1.3.2",
|
|
51
|
+
"eslint": "^8.22.0",
|
|
52
|
+
"gzip-size": "^7.0.0",
|
|
48
53
|
"husky": "^7.0.4",
|
|
49
54
|
"idtoken-verifier": "^2.2.2",
|
|
50
|
-
"jest": "^
|
|
51
|
-
"jest-
|
|
52
|
-
"jest-
|
|
55
|
+
"jest": "^28.1.3",
|
|
56
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
57
|
+
"jest-fetch-mock": "^3.0.3",
|
|
58
|
+
"jest-junit": "^14.0.0",
|
|
59
|
+
"jest-localstorage-mock": "^2.4.22",
|
|
53
60
|
"jsonwebtoken": "^8.5.1",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
61
|
+
"node-fetch": "^3.2.10",
|
|
62
|
+
"oidc-provider": "^7.11.5",
|
|
63
|
+
"prettier": "^2.7.1",
|
|
56
64
|
"pretty-quick": "^3.1.2",
|
|
57
65
|
"qss": "^2.0.3",
|
|
58
66
|
"rimraf": "^3.0.2",
|
|
59
|
-
"rollup": "^2.
|
|
67
|
+
"rollup": "^2.78.0",
|
|
60
68
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
61
69
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
62
70
|
"rollup-plugin-dev": "^1.1.3",
|
|
@@ -64,27 +72,18 @@
|
|
|
64
72
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
65
73
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
66
74
|
"rollup-plugin-terser": "^7.0.2",
|
|
67
|
-
"rollup-plugin-typescript2": "^0.
|
|
68
|
-
"rollup-plugin-visualizer": "^5.
|
|
75
|
+
"rollup-plugin-typescript2": "^0.32.1",
|
|
76
|
+
"rollup-plugin-visualizer": "^5.7.1",
|
|
69
77
|
"rollup-plugin-web-worker-loader": "^1.6.1",
|
|
70
|
-
"serve": "^
|
|
71
|
-
"ts-jest": "^
|
|
78
|
+
"serve": "^14.0.1",
|
|
79
|
+
"ts-jest": "^28.0.8",
|
|
72
80
|
"tslib": "^2.4.0",
|
|
73
81
|
"tslint": "^6.1.3",
|
|
74
82
|
"tslint-config-security": "^1.16.0",
|
|
75
|
-
"typedoc": "0.
|
|
76
|
-
"typescript": "^4.
|
|
83
|
+
"typedoc": "^0.23.10",
|
|
84
|
+
"typescript": "^4.7.4",
|
|
77
85
|
"wait-on": "^6.0.0"
|
|
78
86
|
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"abortcontroller-polyfill": "^1.7.3",
|
|
81
|
-
"browser-tabs-lock": "^1.2.15",
|
|
82
|
-
"core-js": "^3.24.0",
|
|
83
|
-
"es-cookie": "~1.3.2",
|
|
84
|
-
"fast-text-encoding": "^1.0.4",
|
|
85
|
-
"promise-polyfill": "^8.2.3",
|
|
86
|
-
"unfetch": "^4.2.0"
|
|
87
|
-
},
|
|
88
87
|
"files": [
|
|
89
88
|
"src",
|
|
90
89
|
"dist"
|