@auth0/auth0-spa-js 2.0.3 → 2.0.5
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 +7 -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 +7 -4
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/global.d.ts +22 -4
- package/dist/typings/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Auth0Client.ts +2 -2
- package/src/global.ts +22 -4
- package/src/http.ts +9 -1
- package/src/version.ts +1 -1
- package/src/worker/token.worker.ts +1 -0
package/dist/typings/global.d.ts
CHANGED
|
@@ -272,12 +272,21 @@ export interface RedirectLoginOptions<TAppState = any> extends BaseLoginOptions
|
|
|
272
272
|
*
|
|
273
273
|
* @example
|
|
274
274
|
* const client = new Auth0Client({
|
|
275
|
-
*
|
|
275
|
+
* openUrl(url) {
|
|
276
276
|
* window.location.replace(url);
|
|
277
277
|
* }
|
|
278
278
|
* });
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* import { Browser } from '@capacitor/browser';
|
|
282
|
+
*
|
|
283
|
+
* const client = new Auth0Client({
|
|
284
|
+
* async openUrl(url) {
|
|
285
|
+
* await Browser.open({ url });
|
|
286
|
+
* }
|
|
287
|
+
* });
|
|
279
288
|
*/
|
|
280
|
-
openUrl?: (url: string) => Promise<void
|
|
289
|
+
openUrl?: (url: string) => Promise<void> | void;
|
|
281
290
|
}
|
|
282
291
|
export interface RedirectLoginResult<TAppState = any> {
|
|
283
292
|
/**
|
|
@@ -417,12 +426,21 @@ export interface LogoutOptions extends LogoutUrlOptions {
|
|
|
417
426
|
*
|
|
418
427
|
* @example
|
|
419
428
|
* await auth0.logout({
|
|
420
|
-
*
|
|
429
|
+
* openUrl(url) {
|
|
421
430
|
* window.location.replace(url);
|
|
422
431
|
* }
|
|
423
432
|
* });
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* import { Browser } from '@capacitor/browser';
|
|
436
|
+
*
|
|
437
|
+
* await auth0.logout({
|
|
438
|
+
* async openUrl(url) {
|
|
439
|
+
* await Browser.open({ url });
|
|
440
|
+
* }
|
|
441
|
+
* });
|
|
424
442
|
*/
|
|
425
|
-
openUrl?: false | ((url: string) => Promise<void>);
|
|
443
|
+
openUrl?: false | ((url: string) => Promise<void> | void);
|
|
426
444
|
}
|
|
427
445
|
/**
|
|
428
446
|
* @ignore
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.0.
|
|
1
|
+
declare const _default: "2.0.5";
|
|
2
2
|
export default _default;
|
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.0.
|
|
6
|
+
"version": "2.0.5",
|
|
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",
|
package/src/Auth0Client.ts
CHANGED
|
@@ -493,7 +493,7 @@ export class Auth0Client {
|
|
|
493
493
|
const transaction = this.transactionManager.get();
|
|
494
494
|
|
|
495
495
|
if (!transaction) {
|
|
496
|
-
throw new
|
|
496
|
+
throw new GenericError('missing_transaction', 'Invalid state');
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
this.transactionManager.remove();
|
|
@@ -512,7 +512,7 @@ export class Auth0Client {
|
|
|
512
512
|
!transaction.code_verifier ||
|
|
513
513
|
(transaction.state && transaction.state !== state)
|
|
514
514
|
) {
|
|
515
|
-
throw new
|
|
515
|
+
throw new GenericError('state_mismatch', 'Invalid state');
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
const organizationId = transaction.organizationId;
|
package/src/global.ts
CHANGED
|
@@ -305,12 +305,21 @@ export interface RedirectLoginOptions<TAppState = any>
|
|
|
305
305
|
*
|
|
306
306
|
* @example
|
|
307
307
|
* const client = new Auth0Client({
|
|
308
|
-
*
|
|
308
|
+
* openUrl(url) {
|
|
309
309
|
* window.location.replace(url);
|
|
310
310
|
* }
|
|
311
311
|
* });
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* import { Browser } from '@capacitor/browser';
|
|
315
|
+
*
|
|
316
|
+
* const client = new Auth0Client({
|
|
317
|
+
* async openUrl(url) {
|
|
318
|
+
* await Browser.open({ url });
|
|
319
|
+
* }
|
|
320
|
+
* });
|
|
312
321
|
*/
|
|
313
|
-
openUrl?: (url: string) => Promise<void
|
|
322
|
+
openUrl?: (url: string) => Promise<void> | void;
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
export interface RedirectLoginResult<TAppState = any> {
|
|
@@ -466,12 +475,21 @@ export interface LogoutOptions extends LogoutUrlOptions {
|
|
|
466
475
|
*
|
|
467
476
|
* @example
|
|
468
477
|
* await auth0.logout({
|
|
469
|
-
*
|
|
478
|
+
* openUrl(url) {
|
|
470
479
|
* window.location.replace(url);
|
|
471
480
|
* }
|
|
472
481
|
* });
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* import { Browser } from '@capacitor/browser';
|
|
485
|
+
*
|
|
486
|
+
* await auth0.logout({
|
|
487
|
+
* async openUrl(url) {
|
|
488
|
+
* await Browser.open({ url });
|
|
489
|
+
* }
|
|
490
|
+
* });
|
|
473
491
|
*/
|
|
474
|
-
openUrl?: false | ((url: string) => Promise<void>);
|
|
492
|
+
openUrl?: false | ((url: string) => Promise<void> | void);
|
|
475
493
|
}
|
|
476
494
|
|
|
477
495
|
/**
|
package/src/http.ts
CHANGED
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import { sendMessage } from './worker/worker.utils';
|
|
7
7
|
import { FetchOptions } from './global';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
GenericError,
|
|
10
|
+
MfaRequiredError,
|
|
11
|
+
MissingRefreshTokenError
|
|
12
|
+
} from './errors';
|
|
9
13
|
|
|
10
14
|
export const createAbortController = () => new AbortController();
|
|
11
15
|
|
|
@@ -142,6 +146,10 @@ export async function getJSON<T>(
|
|
|
142
146
|
throw new MfaRequiredError(error, errorMessage, data.mfa_token);
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
if (error === 'missing_refresh_token') {
|
|
150
|
+
throw new MissingRefreshTokenError(audience, scope);
|
|
151
|
+
}
|
|
152
|
+
|
|
145
153
|
throw new GenericError(error || 'request_error', errorMessage);
|
|
146
154
|
}
|
|
147
155
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.0.
|
|
1
|
+
export default '2.0.5';
|