@auth0/auth0-angular 2.2.3 → 2.4.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.
Files changed (34) hide show
  1. package/README.md +3 -2
  2. package/esm2022/lib/abstract-navigator.mjs +35 -0
  3. package/esm2022/lib/auth.client.mjs +23 -0
  4. package/esm2022/lib/auth.config.mjs +97 -0
  5. package/esm2022/lib/auth.guard.mjs +40 -0
  6. package/esm2022/lib/auth.interceptor.mjs +134 -0
  7. package/{esm2020 → esm2022}/lib/auth.module.mjs +5 -5
  8. package/esm2022/lib/auth.service.mjs +296 -0
  9. package/{esm2020 → esm2022}/lib/auth.state.mjs +6 -6
  10. package/esm2022/lib/interfaces.mjs +2 -0
  11. package/esm2022/public-api.mjs +16 -0
  12. package/{esm2020 → esm2022}/useragent.mjs +2 -2
  13. package/{fesm2020 → fesm2022}/auth0-auth0-angular.mjs +103 -37
  14. package/fesm2022/auth0-auth0-angular.mjs.map +1 -0
  15. package/lib/auth.config.d.ts +1 -1
  16. package/lib/auth.guard.d.ts +2 -2
  17. package/lib/auth.service.d.ts +62 -2
  18. package/package.json +7 -13
  19. package/public-api.d.ts +1 -1
  20. package/esm2020/lib/abstract-navigator.mjs +0 -35
  21. package/esm2020/lib/auth.client.mjs +0 -23
  22. package/esm2020/lib/auth.config.mjs +0 -97
  23. package/esm2020/lib/auth.guard.mjs +0 -36
  24. package/esm2020/lib/auth.interceptor.mjs +0 -134
  25. package/esm2020/lib/auth.service.mjs +0 -233
  26. package/esm2020/lib/interfaces.mjs +0 -2
  27. package/esm2020/public-api.mjs +0 -16
  28. package/fesm2015/auth0-auth0-angular.mjs +0 -736
  29. package/fesm2015/auth0-auth0-angular.mjs.map +0 -1
  30. package/fesm2020/auth0-auth0-angular.mjs.map +0 -1
  31. /package/{esm2020 → esm2022}/auth0-auth0-angular.mjs +0 -0
  32. /package/{esm2020 → esm2022}/lib/functional.mjs +0 -0
  33. /package/{esm2020 → esm2022}/lib/provide.mjs +0 -0
  34. /package/{auth0-auth0-angular.d.ts → index.d.ts} +0 -0
@@ -4,11 +4,11 @@ import { BehaviorSubject, Subject, ReplaySubject, merge, defer, of, iif, from, t
4
4
  import { scan, filter, distinctUntilChanged, switchMap, mergeMap, shareReplay, concatMap, catchError, tap, takeUntil, withLatestFrom, map, take, first, mapTo, pluck } from 'rxjs/operators';
5
5
  import * as i4 from '@auth0/auth0-spa-js';
6
6
  import { Auth0Client } from '@auth0/auth0-spa-js';
7
- export { AuthenticationError, GenericError, InMemoryCache, LocalStorageCache, MfaRequiredError, MissingRefreshTokenError, PopupCancelledError, PopupTimeoutError, TimeoutError, User } from '@auth0/auth0-spa-js';
7
+ export { AuthenticationError, GenericError, InMemoryCache, LocalStorageCache, MfaRequiredError, MissingRefreshTokenError, PopupCancelledError, PopupTimeoutError, TimeoutError, UseDpopNonceError, User } from '@auth0/auth0-spa-js';
8
8
  import { Router } from '@angular/router';
9
9
  import * as i1 from '@angular/common';
10
10
 
11
- var useragent = { name: '@auth0/auth0-angular', version: '2.2.3' };
11
+ var useragent = { name: '@auth0/auth0-angular', version: '2.4.0' };
12
12
 
13
13
  class Auth0ClientFactory {
14
14
  static createClient(configFactory) {
@@ -112,18 +112,18 @@ class AuthClientConfig {
112
112
  get() {
113
113
  return this.config;
114
114
  }
115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthClientConfig, deps: [{ token: AuthConfigService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
116
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthClientConfig, providedIn: 'root' }); }
115
117
  }
116
- AuthClientConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthClientConfig, deps: [{ token: AuthConfigService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
117
- AuthClientConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthClientConfig, providedIn: 'root' });
118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthClientConfig, decorators: [{
118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthClientConfig, decorators: [{
119
119
  type: Injectable,
120
120
  args: [{ providedIn: 'root' }]
121
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
121
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
122
122
  type: Optional
123
123
  }, {
124
124
  type: Inject,
125
125
  args: [AuthConfigService]
126
- }] }]; } });
126
+ }] }] });
127
127
 
128
128
  class AbstractNavigator {
129
129
  constructor(location, injector) {
@@ -146,15 +146,15 @@ class AbstractNavigator {
146
146
  }
147
147
  this.location.replaceState(url);
148
148
  }
149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AbstractNavigator, deps: [{ token: i1.Location }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
150
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AbstractNavigator, providedIn: 'root' }); }
149
151
  }
150
- AbstractNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, deps: [{ token: i1.Location }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
151
- AbstractNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, providedIn: 'root' });
152
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, decorators: [{
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AbstractNavigator, decorators: [{
153
153
  type: Injectable,
154
154
  args: [{
155
155
  providedIn: 'root',
156
156
  }]
157
- }], ctorParameters: function () { return [{ type: i1.Location }, { type: i0.Injector }]; } });
157
+ }], ctorParameters: () => [{ type: i1.Location }, { type: i0.Injector }] });
158
158
 
159
159
  /**
160
160
  * Tracks the Authentication State for the SDK
@@ -239,16 +239,16 @@ class AuthState {
239
239
  setError(error) {
240
240
  this.errorSubject$.next(error);
241
241
  }
242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthState, deps: [{ token: Auth0ClientService }], target: i0.ɵɵFactoryTarget.Injectable }); }
243
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthState, providedIn: 'root' }); }
242
244
  }
243
- AuthState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthState, deps: [{ token: Auth0ClientService }], target: i0.ɵɵFactoryTarget.Injectable });
244
- AuthState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthState, providedIn: 'root' });
245
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthState, decorators: [{
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthState, decorators: [{
246
246
  type: Injectable,
247
247
  args: [{ providedIn: 'root' }]
248
- }], ctorParameters: function () { return [{ type: i4.Auth0Client, decorators: [{
248
+ }], ctorParameters: () => [{ type: i4.Auth0Client, decorators: [{
249
249
  type: Inject,
250
250
  args: [Auth0ClientService]
251
- }] }]; } });
251
+ }] }] });
252
252
 
253
253
  class AuthService {
254
254
  constructor(auth0Client, configFactory, navigator, authState) {
@@ -453,6 +453,69 @@ class AuthService {
453
453
  this.navigator.navigateByUrl(target);
454
454
  }), map(([result]) => result));
455
455
  }
456
+ /**
457
+ * ```js
458
+ * getDpopNonce(id).subscribe(nonce => ...)
459
+ * ```
460
+ *
461
+ * Gets the DPoP nonce for the specified domain or the default domain.
462
+ * The nonce is used in DPoP proof generation for token binding.
463
+ *
464
+ * @param id Optional identifier for the domain. If not provided, uses the default domain.
465
+ * @returns An Observable that emits the DPoP nonce string or undefined if not available.
466
+ */
467
+ getDpopNonce(id) {
468
+ return from(this.auth0Client.getDpopNonce(id));
469
+ }
470
+ /**
471
+ * ```js
472
+ * setDpopNonce(nonce, id).subscribe(() => ...)
473
+ * ```
474
+ *
475
+ * Sets the DPoP nonce for the specified domain or the default domain.
476
+ * This is typically used after receiving a new nonce from the authorization server.
477
+ *
478
+ * @param nonce The DPoP nonce value to set.
479
+ * @param id Optional identifier for the domain. If not provided, uses the default domain.
480
+ * @returns An Observable that completes when the nonce is set.
481
+ */
482
+ setDpopNonce(nonce, id) {
483
+ return from(this.auth0Client.setDpopNonce(nonce, id));
484
+ }
485
+ /**
486
+ * ```js
487
+ * generateDpopProof(params).subscribe(proof => ...)
488
+ * ```
489
+ *
490
+ * Generates a DPoP (Demonstrating Proof-of-Possession) proof JWT.
491
+ * This proof is used to bind access tokens to a specific client, providing
492
+ * an additional layer of security for token usage.
493
+ *
494
+ * @param params Configuration for generating the DPoP proof
495
+ * @param params.url The URL of the resource server endpoint
496
+ * @param params.method The HTTP method (e.g., 'GET', 'POST')
497
+ * @param params.nonce Optional DPoP nonce from the authorization server
498
+ * @param params.accessToken The access token to bind to the proof
499
+ * @returns An Observable that emits the generated DPoP proof as a JWT string.
500
+ */
501
+ generateDpopProof(params) {
502
+ return from(this.auth0Client.generateDpopProof(params));
503
+ }
504
+ /**
505
+ * ```js
506
+ * const fetcher = createFetcher(config);
507
+ * ```
508
+ *
509
+ * Creates a custom fetcher instance that can be used to make authenticated
510
+ * HTTP requests. The fetcher automatically handles token refresh and can
511
+ * be configured with custom request/response handling.
512
+ *
513
+ * @param config Optional configuration for the fetcher
514
+ * @returns A Fetcher instance configured with the Auth0 client.
515
+ */
516
+ createFetcher(config) {
517
+ return this.auth0Client.createFetcher(config);
518
+ }
456
519
  shouldHandleCallback() {
457
520
  return of(location.search).pipe(map((search) => {
458
521
  const searchParams = new URLSearchParams(search);
@@ -461,18 +524,18 @@ class AuthService {
461
524
  !this.configFactory.get().skipRedirectCallback);
462
525
  }));
463
526
  }
527
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthService, deps: [{ token: Auth0ClientService }, { token: AuthClientConfig }, { token: AbstractNavigator }, { token: AuthState }], target: i0.ɵɵFactoryTarget.Injectable }); }
528
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthService, providedIn: 'root' }); }
464
529
  }
465
- AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthService, deps: [{ token: Auth0ClientService }, { token: AuthClientConfig }, { token: AbstractNavigator }, { token: AuthState }], target: i0.ɵɵFactoryTarget.Injectable });
466
- AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthService, providedIn: 'root' });
467
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthService, decorators: [{
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthService, decorators: [{
468
531
  type: Injectable,
469
532
  args: [{
470
533
  providedIn: 'root',
471
534
  }]
472
- }], ctorParameters: function () { return [{ type: i4.Auth0Client, decorators: [{
535
+ }], ctorParameters: () => [{ type: i4.Auth0Client, decorators: [{
473
536
  type: Inject,
474
537
  args: [Auth0ClientService]
475
- }] }, { type: AuthClientConfig }, { type: AbstractNavigator }, { type: AuthState }]; } });
538
+ }] }, { type: AuthClientConfig }, { type: AbstractNavigator }, { type: AuthState }] });
476
539
 
477
540
  class AuthGuard {
478
541
  constructor(auth) {
@@ -488,23 +551,26 @@ class AuthGuard {
488
551
  return this.redirectIfUnauthenticated(state);
489
552
  }
490
553
  redirectIfUnauthenticated(state) {
491
- return this.auth.isAuthenticated$.pipe(tap((loggedIn) => {
554
+ return this.auth.isAuthenticated$.pipe(switchMap((loggedIn) => {
492
555
  if (!loggedIn) {
493
- this.auth.loginWithRedirect({
556
+ return this.auth
557
+ .loginWithRedirect({
494
558
  appState: { target: state.url },
495
- });
559
+ })
560
+ .pipe(map(() => false));
496
561
  }
562
+ return of(true);
497
563
  }));
498
564
  }
565
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
566
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, providedIn: 'root' }); }
499
567
  }
500
- AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthGuard, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
501
- AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthGuard, providedIn: 'root' });
502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthGuard, decorators: [{
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, decorators: [{
503
569
  type: Injectable,
504
570
  args: [{
505
571
  providedIn: 'root',
506
572
  }]
507
- }], ctorParameters: function () { return [{ type: AuthService }]; } });
573
+ }], ctorParameters: () => [{ type: AuthService }] });
508
574
 
509
575
  class AuthModule {
510
576
  /**
@@ -531,11 +597,11 @@ class AuthModule {
531
597
  ],
532
598
  };
533
599
  }
600
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
601
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: AuthModule }); }
602
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthModule }); }
534
603
  }
535
- AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
536
- AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthModule });
537
- AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthModule });
538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthModule, decorators: [{
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthModule, decorators: [{
539
605
  type: NgModule
540
606
  }] });
541
607
 
@@ -653,15 +719,15 @@ class AuthHttpInterceptor {
653
719
  !!route.allowAnonymous &&
654
720
  ['login_required', 'consent_required', 'missing_refresh_token'].includes(err.error));
655
721
  }
722
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthHttpInterceptor, deps: [{ token: AuthClientConfig }, { token: Auth0ClientService }, { token: AuthState }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
723
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthHttpInterceptor }); }
656
724
  }
657
- AuthHttpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthHttpInterceptor, deps: [{ token: AuthClientConfig }, { token: Auth0ClientService }, { token: AuthState }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
658
- AuthHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthHttpInterceptor });
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AuthHttpInterceptor, decorators: [{
725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthHttpInterceptor, decorators: [{
660
726
  type: Injectable
661
- }], ctorParameters: function () { return [{ type: AuthClientConfig }, { type: i4.Auth0Client, decorators: [{
727
+ }], ctorParameters: () => [{ type: AuthClientConfig }, { type: i4.Auth0Client, decorators: [{
662
728
  type: Inject,
663
729
  args: [Auth0ClientService]
664
- }] }, { type: AuthState }, { type: AuthService }]; } });
730
+ }] }, { type: AuthState }, { type: AuthService }] });
665
731
 
666
732
  /**
667
733
  * Initialize the authentication system. Configuration can either be specified here,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth0-auth0-angular.mjs","sources":["../../../projects/auth0-angular/src/useragent.ts","../../../projects/auth0-angular/src/lib/auth.client.ts","../../../projects/auth0-angular/src/lib/auth.config.ts","../../../projects/auth0-angular/src/lib/abstract-navigator.ts","../../../projects/auth0-angular/src/lib/auth.state.ts","../../../projects/auth0-angular/src/lib/auth.service.ts","../../../projects/auth0-angular/src/lib/auth.guard.ts","../../../projects/auth0-angular/src/lib/auth.module.ts","../../../projects/auth0-angular/src/lib/auth.interceptor.ts","../../../projects/auth0-angular/src/lib/provide.ts","../../../projects/auth0-angular/src/lib/functional.ts","../../../projects/auth0-angular/src/public-api.ts","../../../projects/auth0-angular/src/auth0-auth0-angular.ts"],"sourcesContent":["export default { name: '@auth0/auth0-angular', version: '2.4.0' };\n","import { InjectionToken, VERSION } from '@angular/core';\nimport { Auth0Client } from '@auth0/auth0-spa-js';\nimport { AuthClientConfig } from './auth.config';\nimport useragent from '../useragent';\n\nexport class Auth0ClientFactory {\n static createClient(configFactory: AuthClientConfig): Auth0Client {\n const config = configFactory.get();\n\n if (!config) {\n throw new Error(\n 'Configuration must be specified either through AuthModule.forRoot or through AuthClientConfig.set'\n );\n }\n\n return new Auth0Client({\n ...config,\n auth0Client: {\n name: useragent.name,\n version: useragent.version,\n env: {\n 'angular/core': VERSION.full,\n },\n },\n });\n }\n}\n\nexport const Auth0ClientService = new InjectionToken<Auth0Client>(\n 'auth0.client'\n);\n","import {\n Auth0ClientOptions,\n CacheLocation,\n GetTokenSilentlyOptions,\n ICache,\n} from '@auth0/auth0-spa-js';\n\nimport { InjectionToken, Injectable, Optional, Inject } from '@angular/core';\n\n/**\n * Defines a common set of HTTP methods.\n */\nexport const enum HttpMethod {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Patch = 'PATCH',\n Delete = 'DELETE',\n Head = 'HEAD',\n}\n\n/**\n * Defines the type for a route config entry. Can either be:\n *\n * - an object of type HttpInterceptorRouteConfig\n * - a string\n */\nexport type ApiRouteDefinition = HttpInterceptorRouteConfig | string;\n\n/**\n * A custom type guard to help identify route definitions that are actually HttpInterceptorRouteConfig types.\n *\n * @param def The route definition type\n */\nexport function isHttpInterceptorRouteConfig(\n def: ApiRouteDefinition\n): def is HttpInterceptorRouteConfig {\n return typeof def !== 'string';\n}\n\n/**\n * Configuration for the HttpInterceptor\n */\nexport interface HttpInterceptorConfig {\n allowedList: ApiRouteDefinition[];\n}\n\n/**\n * Configuration for a single interceptor route\n */\nexport interface HttpInterceptorRouteConfig {\n /**\n * The URL to test, by supplying the URL to match.\n * If `test` is a match for the current request path from the HTTP client, then\n * an access token is attached to the request in the\n * [\"Authorization\" header](https://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-20#section-2.1).\n *\n * If the test does not pass, the request proceeds without the access token attached.\n *\n * A wildcard character can be used to match only the start of the URL.\n *\n * @usagenotes\n *\n * '/api' - exactly match the route /api\n * '/api/*' - match any route that starts with /api/\n */\n uri?: string;\n\n /**\n * A function that will be called with the HttpRequest.url value, allowing you to do\n * any kind of flexible matching.\n *\n * If this function returns true, then\n * an access token is attached to the request in the\n * [\"Authorization\" header](https://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-20#section-2.1).\n *\n * If it returns false, the request proceeds without the access token attached.\n */\n uriMatcher?: (uri: string) => boolean;\n\n /**\n * The options that are passed to the SDK when retrieving the\n * access token to attach to the outgoing request.\n */\n tokenOptions?: GetTokenSilentlyOptions;\n\n /**\n * The HTTP method to match on. If specified, the HTTP method of\n * the outgoing request will be checked against this. If there is no match, the\n * Authorization header is not attached.\n *\n * The HTTP method name is case-sensitive.\n */\n httpMethod?: HttpMethod | string;\n\n /**\n * Allow the HTTP call to be executed anonymously, when no token is available.\n *\n * When omitted (or set to false), calls that match the configuration will fail when no token is available.\n */\n allowAnonymous?: boolean;\n}\n\n/**\n * Configuration for the authentication service\n */\nexport interface AuthConfig extends Auth0ClientOptions {\n /**\n * By default, if the page URL has code and state parameters, the SDK will assume they are for\n * an Auth0 application and attempt to exchange the code for a token.\n * In some cases the code might be for something else (e.g. another OAuth SDK). In these\n * instances you can instruct the client to ignore them by setting `skipRedirectCallback`.\n *\n * ```js\n * AuthModule.forRoot({\n * skipRedirectCallback: window.location.pathname === '/other-callback'\n * })\n * ```\n *\n * **Note**: In the above example, `/other-callback` is an existing route that will be called\n * by any other OAuth provider with a `code` (or `error` in case when something went wrong) and `state`.\n *\n */\n skipRedirectCallback?: boolean;\n\n /**\n * Configuration for the built-in Http Interceptor, used for\n * automatically attaching access tokens.\n */\n httpInterceptor?: HttpInterceptorConfig;\n\n /**\n * Path in your application to redirect to when the Authorization server\n * returns an error. Defaults to `/`\n */\n errorPath?: string;\n}\n\n/**\n * Angular specific state to be stored before redirect\n */\nexport interface AppState {\n /**\n * Target path the app gets routed to after\n * handling the callback from Auth0 (defaults to '/')\n */\n target?: string;\n\n /**\n * Any custom parameter to be stored in appState\n */\n [key: string]: any;\n}\n\n/**\n * Injection token for accessing configuration.\n *\n * @usageNotes\n *\n * Use the `Inject` decorator to access the configuration from a service or component:\n *\n * ```\n * class MyService(@Inject(AuthConfigService) config: AuthConfig) {}\n * ```\n */\nexport const AuthConfigService = new InjectionToken<AuthConfig>(\n 'auth0-angular.config'\n);\n\n/**\n * Gets and sets configuration for the internal Auth0 client. This can be\n * used to provide configuration outside of using AuthModule.forRoot, i.e. from\n * a factory provided by APP_INITIALIZER.\n *\n * @usage\n *\n * ```js\n * // app.module.ts\n * // ---------------------------\n * import { AuthModule, AuthClientConfig } from '@auth0/auth0-angular';\n *\n * // Provide an initializer function that returns a Promise\n * function configInitializer(\n * http: HttpClient,\n * config: AuthClientConfig\n * ) {\n * return () =>\n * http\n * .get('/config')\n * .toPromise()\n * .then((loadedConfig: any) => config.set(loadedConfig)); // Set the config that was loaded asynchronously here\n * }\n *\n * // Provide APP_INITIALIZER with this function. Note that there is no config passed to AuthModule.forRoot\n * imports: [\n * // other imports..\n *\n * HttpClientModule,\n * AuthModule.forRoot(), //<- don't pass any config here\n * ],\n * providers: [\n * {\n * provide: APP_INITIALIZER,\n * useFactory: configInitializer, // <- pass your initializer function here\n * deps: [HttpClient, AuthClientConfig],\n * multi: true,\n * },\n * ],\n * ```\n *\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthClientConfig {\n private config?: AuthConfig;\n\n constructor(@Optional() @Inject(AuthConfigService) config?: AuthConfig) {\n if (config) {\n this.set(config);\n }\n }\n\n /**\n * Sets configuration to be read by other consumers of the service (see usage notes)\n *\n * @param config The configuration to set\n */\n set(config: AuthConfig): void {\n this.config = config;\n }\n\n /**\n * Gets the config that has been set by other consumers of the service\n */\n get(): AuthConfig {\n return this.config as AuthConfig;\n }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Location } from '@angular/common';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AbstractNavigator {\n private readonly router?: Router;\n\n constructor(private location: Location, injector: Injector) {\n try {\n this.router = injector.get(Router);\n } catch {}\n }\n\n /**\n * Navigates to the specified url. The router will be used if one is available, otherwise it falls back\n * to `window.history.replaceState`.\n *\n * @param url The url to navigate to\n */\n navigateByUrl(url: string): void {\n if (this.router) {\n this.router.navigateByUrl(url);\n\n return;\n }\n\n this.location.replaceState(url);\n }\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { Auth0Client } from '@auth0/auth0-spa-js';\nimport {\n BehaviorSubject,\n defer,\n merge,\n of,\n ReplaySubject,\n Subject,\n} from 'rxjs';\nimport {\n concatMap,\n distinctUntilChanged,\n filter,\n mergeMap,\n scan,\n shareReplay,\n switchMap,\n} from 'rxjs/operators';\nimport { Auth0ClientService } from './auth.client';\n\n/**\n * Tracks the Authentication State for the SDK\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthState {\n private isLoadingSubject$ = new BehaviorSubject<boolean>(true);\n private refresh$ = new Subject<void>();\n private accessToken$ = new ReplaySubject<string>(1);\n private errorSubject$ = new ReplaySubject<Error>(1);\n\n /**\n * Emits boolean values indicating the loading state of the SDK.\n */\n public readonly isLoading$ = this.isLoadingSubject$.asObservable();\n\n /**\n * Trigger used to pull User information from the Auth0Client.\n * Triggers when the access token has changed.\n */\n private accessTokenTrigger$ = this.accessToken$.pipe(\n scan(\n (\n acc: { current: string | null; previous: string | null },\n current: string | null\n ) => ({\n previous: acc.current,\n current,\n }),\n { current: null, previous: null }\n ),\n filter(({ previous, current }) => previous !== current)\n );\n\n /**\n * Trigger used to pull User information from the Auth0Client.\n * Triggers when an event occurs that needs to retrigger the User Profile information.\n * Events: Login, Access Token change and Logout\n */\n private readonly isAuthenticatedTrigger$ = this.isLoading$.pipe(\n filter((loading) => !loading),\n distinctUntilChanged(),\n switchMap(() =>\n // To track the value of isAuthenticated over time, we need to merge:\n // - the current value\n // - the value whenever the access token changes. (this should always be true of there is an access token\n // but it is safer to pass this through this.auth0Client.isAuthenticated() nevertheless)\n // - the value whenever refreshState$ emits\n merge(\n defer(() => this.auth0Client.isAuthenticated()),\n this.accessTokenTrigger$.pipe(\n mergeMap(() => this.auth0Client.isAuthenticated())\n ),\n this.refresh$.pipe(mergeMap(() => this.auth0Client.isAuthenticated()))\n )\n )\n );\n\n /**\n * Emits boolean values indicating the authentication state of the user. If `true`, it means a user has authenticated.\n * This depends on the value of `isLoading$`, so there is no need to manually check the loading state of the SDK.\n */\n readonly isAuthenticated$ = this.isAuthenticatedTrigger$.pipe(\n distinctUntilChanged(),\n shareReplay(1)\n );\n\n /**\n * Emits details about the authenticated user, or null if not authenticated.\n */\n readonly user$ = this.isAuthenticatedTrigger$.pipe(\n concatMap((authenticated) =>\n authenticated ? this.auth0Client.getUser() : of(null)\n ),\n distinctUntilChanged()\n );\n\n /**\n * Emits ID token claims when authenticated, or null if not authenticated.\n */\n readonly idTokenClaims$ = this.isAuthenticatedTrigger$.pipe(\n concatMap((authenticated) =>\n authenticated ? this.auth0Client.getIdTokenClaims() : of(null)\n )\n );\n\n /**\n * Emits errors that occur during login, or when checking for an active session on startup.\n */\n public readonly error$ = this.errorSubject$.asObservable();\n\n constructor(@Inject(Auth0ClientService) private auth0Client: Auth0Client) {}\n\n /**\n * Update the isLoading state using the provided value\n *\n * @param isLoading The new value for isLoading\n */\n public setIsLoading(isLoading: boolean): void {\n this.isLoadingSubject$.next(isLoading);\n }\n\n /**\n * Refresh the state to ensure the `isAuthenticated`, `user$` and `idTokenClaims$`\n * reflect the most up-to-date values from Auth0Client.\n */\n public refresh(): void {\n this.refresh$.next();\n }\n\n /**\n * Update the access token, doing so will also refresh the state.\n *\n * @param accessToken The new Access Token\n */\n public setAccessToken(accessToken: string): void {\n this.accessToken$.next(accessToken);\n }\n\n /**\n * Emits the error in the `error$` observable.\n *\n * @param error The new error\n */\n public setError(error: any): void {\n this.errorSubject$.next(error);\n }\n}\n","import { Injectable, Inject, OnDestroy } from '@angular/core';\n\nimport {\n Auth0Client,\n PopupLoginOptions,\n PopupConfigOptions,\n GetTokenSilentlyOptions,\n GetTokenWithPopupOptions,\n RedirectLoginResult,\n GetTokenSilentlyVerboseResponse,\n ConnectAccountRedirectResult,\n CustomFetchMinimalOutput,\n Fetcher,\n FetcherConfig,\n} from '@auth0/auth0-spa-js';\n\nimport {\n of,\n from,\n Subject,\n Observable,\n iif,\n defer,\n ReplaySubject,\n throwError,\n} from 'rxjs';\n\nimport {\n concatMap,\n tap,\n map,\n takeUntil,\n catchError,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport { Auth0ClientService } from './auth.client';\nimport { AbstractNavigator } from './abstract-navigator';\nimport { AuthClientConfig, AppState } from './auth.config';\nimport { AuthState } from './auth.state';\nimport { LogoutOptions, RedirectLoginOptions } from './interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService<TAppState extends AppState = AppState>\n implements OnDestroy\n{\n private appStateSubject$ = new ReplaySubject<TAppState>(1);\n\n // https://stackoverflow.com/a/41177163\n private ngUnsubscribe$ = new Subject<void>();\n /**\n * Emits boolean values indicating the loading state of the SDK.\n */\n readonly isLoading$ = this.authState.isLoading$;\n\n /**\n * Emits boolean values indicating the authentication state of the user. If `true`, it means a user has authenticated.\n * This depends on the value of `isLoading$`, so there is no need to manually check the loading state of the SDK.\n */\n readonly isAuthenticated$ = this.authState.isAuthenticated$;\n\n /**\n * Emits details about the authenticated user, or null if not authenticated.\n */\n readonly user$ = this.authState.user$;\n\n /**\n * Emits ID token claims when authenticated, or null if not authenticated.\n */\n readonly idTokenClaims$ = this.authState.idTokenClaims$;\n\n /**\n * Emits errors that occur during login, or when checking for an active session on startup.\n */\n readonly error$ = this.authState.error$;\n\n /**\n * Emits the value (if any) that was passed to the `loginWithRedirect` method call\n * but only **after** `handleRedirectCallback` is first called\n */\n readonly appState$ = this.appStateSubject$.asObservable();\n\n constructor(\n @Inject(Auth0ClientService) private auth0Client: Auth0Client,\n private configFactory: AuthClientConfig,\n private navigator: AbstractNavigator,\n private authState: AuthState\n ) {\n const checkSessionOrCallback$ = (isCallback: boolean) =>\n iif(\n () => isCallback,\n this.handleRedirectCallback(),\n defer(() => this.auth0Client.checkSession())\n );\n\n this.shouldHandleCallback()\n .pipe(\n switchMap((isCallback) =>\n checkSessionOrCallback$(isCallback).pipe(\n catchError((error) => {\n const config = this.configFactory.get();\n this.navigator.navigateByUrl(config.errorPath || '/');\n this.authState.setError(error);\n return of(undefined);\n })\n )\n ),\n tap(() => {\n this.authState.setIsLoading(false);\n }),\n takeUntil(this.ngUnsubscribe$)\n )\n .subscribe();\n }\n\n /**\n * Called when the service is destroyed\n */\n ngOnDestroy(): void {\n // https://stackoverflow.com/a/41177163\n this.ngUnsubscribe$.next();\n this.ngUnsubscribe$.complete();\n }\n\n /**\n * ```js\n * loginWithRedirect(options);\n * ```\n *\n * Performs a redirect to `/authorize` using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated.\n *\n * @param options The login options\n */\n loginWithRedirect(\n options?: RedirectLoginOptions<TAppState>\n ): Observable<void> {\n return from(this.auth0Client.loginWithRedirect(options));\n }\n\n /**\n * ```js\n * await loginWithPopup(options);\n * ```\n *\n * Opens a popup with the `/authorize` URL using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated. If the response is successful,\n * results will be valid according to their expiration times.\n *\n * IMPORTANT: This method has to be called from an event handler\n * that was started by the user like a button click, for example,\n * otherwise the popup will be blocked in most browsers.\n *\n * @param options The login options\n * @param config Configuration for the popup window\n */\n loginWithPopup(\n options?: PopupLoginOptions,\n config?: PopupConfigOptions\n ): Observable<void> {\n return from(\n this.auth0Client.loginWithPopup(options, config).then(() => {\n this.authState.refresh();\n })\n );\n }\n\n /**\n * ```js\n * logout();\n * ```\n *\n * Clears the application session and performs a redirect to `/v2/logout`, using\n * the parameters provided as arguments, to clear the Auth0 session.\n * If the `federated` option is specified it also clears the Identity Provider session.\n * If the `openUrl` option is set to false, it only clears the application session.\n * It is invalid to set both the `federated` to true and `openUrl` to `false`,\n * and an error will be thrown if you do.\n * [Read more about how Logout works at Auth0](https://auth0.com/docs/logout).\n *\n * @param options The logout options\n */\n logout(options?: LogoutOptions): Observable<void> {\n return from(\n this.auth0Client.logout(options).then(() => {\n if (options?.openUrl === false || options?.openUrl) {\n this.authState.refresh();\n }\n })\n );\n }\n\n /**\n * Fetches a new access token and returns the response from the /oauth/token endpoint, omitting the refresh token.\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(\n options: GetTokenSilentlyOptions & { detailedResponse: true }\n ): Observable<GetTokenSilentlyVerboseResponse>;\n\n /**\n * Fetches a new access token and returns it.\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(options?: GetTokenSilentlyOptions): Observable<string>;\n\n /**\n * ```js\n * getAccessTokenSilently(options).subscribe(token => ...)\n * ```\n *\n * If there's a valid token stored, return it. Otherwise, opens an\n * iframe with the `/authorize` URL using the parameters provided\n * as arguments. Random and secure `state` and `nonce` parameters\n * will be auto-generated. If the response is successful, results\n * will be valid according to their expiration times.\n *\n * If refresh tokens are used, the token endpoint is called directly with the\n * 'refresh_token' grant. If no refresh token is available to make this call,\n * the SDK falls back to using an iframe to the '/authorize' URL.\n *\n * This method may use a web worker to perform the token call if the in-memory\n * cache is used.\n *\n * If an `audience` value is given to this function, the SDK always falls\n * back to using an iframe to make the token exchange.\n *\n * Note that in all cases, falling back to an iframe requires access to\n * the `auth0` cookie, and thus will not work in browsers that block third-party\n * cookies by default (Safari, Brave, etc).\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(\n options: GetTokenSilentlyOptions = {}\n ): Observable<string | GetTokenSilentlyVerboseResponse> {\n return of(this.auth0Client).pipe(\n concatMap((client) =>\n options.detailedResponse === true\n ? client.getTokenSilently({ ...options, detailedResponse: true })\n : client.getTokenSilently(options)\n ),\n tap((token) => {\n if (token) {\n this.authState.setAccessToken(\n typeof token === 'string' ? token : token.access_token\n );\n }\n }),\n catchError((error) => {\n this.authState.setError(error);\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * ```js\n * getTokenWithPopup(options).subscribe(token => ...)\n * ```\n *\n * Get an access token interactively.\n *\n * Opens a popup with the `/authorize` URL using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated. If the response is successful,\n * results will be valid according to their expiration times.\n */\n getAccessTokenWithPopup(\n options?: GetTokenWithPopupOptions\n ): Observable<string | undefined> {\n return of(this.auth0Client).pipe(\n concatMap((client) => client.getTokenWithPopup(options)),\n tap((token) => {\n if (token) {\n this.authState.setAccessToken(token);\n }\n }),\n catchError((error) => {\n this.authState.setError(error);\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * ```js\n * handleRedirectCallback(url).subscribe(result => ...)\n * ```\n *\n * After the browser redirects back to the callback page,\n * call `handleRedirectCallback` to handle success and error\n * responses from Auth0. If the response is successful, results\n * will be valid according to their expiration times.\n *\n * Calling this method also refreshes the authentication and user states.\n *\n * @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.\n */\n handleRedirectCallback(\n url?: string\n ): Observable<\n RedirectLoginResult<TAppState> | ConnectAccountRedirectResult<TAppState>\n > {\n return defer(() =>\n this.auth0Client.handleRedirectCallback<TAppState>(url)\n ).pipe(\n withLatestFrom(this.authState.isLoading$),\n tap(([result, isLoading]) => {\n if (!isLoading) {\n this.authState.refresh();\n }\n const appState = result?.appState;\n const target = appState?.target ?? '/';\n\n if (appState) {\n this.appStateSubject$.next(appState);\n }\n\n this.navigator.navigateByUrl(target);\n }),\n map(([result]) => result)\n );\n }\n\n /**\n * ```js\n * getDpopNonce(id).subscribe(nonce => ...)\n * ```\n *\n * Gets the DPoP nonce for the specified domain or the default domain.\n * The nonce is used in DPoP proof generation for token binding.\n *\n * @param id Optional identifier for the domain. If not provided, uses the default domain.\n * @returns An Observable that emits the DPoP nonce string or undefined if not available.\n */\n getDpopNonce(id?: string): Observable<string | undefined> {\n return from(this.auth0Client.getDpopNonce(id));\n }\n\n /**\n * ```js\n * setDpopNonce(nonce, id).subscribe(() => ...)\n * ```\n *\n * Sets the DPoP nonce for the specified domain or the default domain.\n * This is typically used after receiving a new nonce from the authorization server.\n *\n * @param nonce The DPoP nonce value to set.\n * @param id Optional identifier for the domain. If not provided, uses the default domain.\n * @returns An Observable that completes when the nonce is set.\n */\n setDpopNonce(nonce: string, id?: string): Observable<void> {\n return from(this.auth0Client.setDpopNonce(nonce, id));\n }\n\n /**\n * ```js\n * generateDpopProof(params).subscribe(proof => ...)\n * ```\n *\n * Generates a DPoP (Demonstrating Proof-of-Possession) proof JWT.\n * This proof is used to bind access tokens to a specific client, providing\n * an additional layer of security for token usage.\n *\n * @param params Configuration for generating the DPoP proof\n * @param params.url The URL of the resource server endpoint\n * @param params.method The HTTP method (e.g., 'GET', 'POST')\n * @param params.nonce Optional DPoP nonce from the authorization server\n * @param params.accessToken The access token to bind to the proof\n * @returns An Observable that emits the generated DPoP proof as a JWT string.\n */\n generateDpopProof(params: {\n url: string;\n method: string;\n nonce?: string;\n accessToken: string;\n }): Observable<string> {\n return from(this.auth0Client.generateDpopProof(params));\n }\n\n /**\n * ```js\n * const fetcher = createFetcher(config);\n * ```\n *\n * Creates a custom fetcher instance that can be used to make authenticated\n * HTTP requests. The fetcher automatically handles token refresh and can\n * be configured with custom request/response handling.\n *\n * @param config Optional configuration for the fetcher\n * @returns A Fetcher instance configured with the Auth0 client.\n */\n createFetcher<TOutput extends CustomFetchMinimalOutput = Response>(\n config?: FetcherConfig<TOutput>\n ): Fetcher<TOutput> {\n return this.auth0Client.createFetcher(config);\n }\n\n private shouldHandleCallback(): Observable<boolean> {\n return of(location.search).pipe(\n map((search) => {\n const searchParams = new URLSearchParams(search);\n return (\n (searchParams.has('code') || searchParams.has('error')) &&\n searchParams.has('state') &&\n !this.configFactory.get().skipRedirectCallback\n );\n })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n Route,\n UrlSegment,\n} from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { take, switchMap, map } from 'rxjs/operators';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuard {\n constructor(private auth: AuthService) {}\n\n canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> {\n return this.auth.isAuthenticated$.pipe(take(1));\n }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.redirectIfUnauthenticated(state);\n }\n\n canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.redirectIfUnauthenticated(state);\n }\n\n private redirectIfUnauthenticated(\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.auth.isAuthenticated$.pipe(\n switchMap((loggedIn) => {\n if (!loggedIn) {\n return this.auth\n .loginWithRedirect({\n appState: { target: state.url },\n })\n .pipe(map(() => false));\n }\n return of(true);\n })\n );\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { AuthService } from './auth.service';\nimport { AuthConfig, AuthConfigService, AuthClientConfig } from './auth.config';\nimport { Auth0ClientService, Auth0ClientFactory } from './auth.client';\nimport { AuthGuard } from './auth.guard';\n\n@NgModule()\nexport class AuthModule {\n /**\n * Initialize the authentication module system. Configuration can either be specified here,\n * or by calling AuthClientConfig.set (perhaps from an APP_INITIALIZER factory function).\n *\n * @param config The optional configuration for the SDK.\n */\n static forRoot(config?: AuthConfig): ModuleWithProviders<AuthModule> {\n return {\n ngModule: AuthModule,\n providers: [\n AuthService,\n AuthGuard,\n {\n provide: AuthConfigService,\n useValue: config,\n },\n {\n provide: Auth0ClientService,\n useFactory: Auth0ClientFactory.createClient,\n deps: [AuthClientConfig],\n },\n ],\n };\n }\n}\n","import {\n HttpInterceptor,\n HttpRequest,\n HttpHandler,\n HttpEvent,\n} from '@angular/common/http';\n\nimport { Observable, from, of, iif, throwError } from 'rxjs';\nimport { Inject, Injectable } from '@angular/core';\n\nimport {\n ApiRouteDefinition,\n isHttpInterceptorRouteConfig,\n AuthClientConfig,\n HttpInterceptorConfig,\n} from './auth.config';\n\nimport {\n switchMap,\n first,\n concatMap,\n catchError,\n tap,\n filter,\n mergeMap,\n mapTo,\n pluck,\n} from 'rxjs/operators';\nimport { Auth0Client, GetTokenSilentlyOptions } from '@auth0/auth0-spa-js';\nimport { Auth0ClientService } from './auth.client';\nimport { AuthState } from './auth.state';\nimport { AuthService } from './auth.service';\n\nconst waitUntil =\n <TSignal>(signal$: Observable<TSignal>) =>\n <TSource>(source$: Observable<TSource>) =>\n source$.pipe(mergeMap((value) => signal$.pipe(first(), mapTo(value))));\n\n@Injectable()\nexport class AuthHttpInterceptor implements HttpInterceptor {\n constructor(\n private configFactory: AuthClientConfig,\n @Inject(Auth0ClientService) private auth0Client: Auth0Client,\n private authState: AuthState,\n private authService: AuthService\n ) {}\n\n intercept(\n req: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n const config = this.configFactory.get();\n if (!config.httpInterceptor?.allowedList) {\n return next.handle(req);\n }\n\n const isLoaded$ = this.authService.isLoading$.pipe(\n filter((isLoading) => !isLoading)\n );\n\n return this.findMatchingRoute(req, config.httpInterceptor).pipe(\n concatMap((route) =>\n iif(\n // Check if a route was matched\n () => route !== null,\n // If we have a matching route, call getTokenSilently and attach the token to the\n // outgoing request\n of(route).pipe(\n waitUntil(isLoaded$),\n pluck('tokenOptions'),\n concatMap<GetTokenSilentlyOptions, Observable<string>>((options) =>\n this.getAccessTokenSilently(options).pipe(\n catchError((err) => {\n if (this.allowAnonymous(route, err)) {\n return of('');\n }\n\n this.authState.setError(err);\n return throwError(err);\n })\n )\n ),\n switchMap((token: string) => {\n // Clone the request and attach the bearer token\n const clone = token\n ? req.clone({\n headers: req.headers.set(\n 'Authorization',\n `Bearer ${token}`\n ),\n })\n : req;\n\n return next.handle(clone);\n })\n ),\n // If the URI being called was not found in our httpInterceptor config, simply\n // pass the request through without attaching a token\n next.handle(req)\n )\n )\n );\n }\n\n /**\n * Duplicate of AuthService.getAccessTokenSilently, but with a slightly different error handling.\n * Only used internally in the interceptor.\n *\n * @param options The options for configuring the token fetch.\n */\n private getAccessTokenSilently(\n options?: GetTokenSilentlyOptions\n ): Observable<string> {\n return of(this.auth0Client).pipe(\n concatMap((client) => client.getTokenSilently(options)),\n tap((token) => this.authState.setAccessToken(token)),\n catchError((error) => {\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * Strips the query and fragment from the given uri\n *\n * @param uri The uri to remove the query and fragment from\n */\n private stripQueryFrom(uri: string): string {\n if (uri.indexOf('?') > -1) {\n uri = uri.substr(0, uri.indexOf('?'));\n }\n\n if (uri.indexOf('#') > -1) {\n uri = uri.substr(0, uri.indexOf('#'));\n }\n\n return uri;\n }\n\n /**\n * Determines whether the specified route can have an access token attached to it, based on matching the HTTP request against\n * the interceptor route configuration.\n *\n * @param route The route to test\n * @param request The HTTP request\n */\n private canAttachToken(\n route: ApiRouteDefinition,\n request: HttpRequest<any>\n ): boolean {\n const testPrimitive = (value: string | undefined): boolean => {\n if (!value) {\n return false;\n }\n\n const requestPath = this.stripQueryFrom(request.url);\n\n if (value === requestPath) {\n return true;\n }\n\n // If the URL ends with an asterisk, match using startsWith.\n return (\n value.indexOf('*') === value.length - 1 &&\n request.url.startsWith(value.substr(0, value.length - 1))\n );\n };\n\n if (isHttpInterceptorRouteConfig(route)) {\n if (route.httpMethod && route.httpMethod !== request.method) {\n return false;\n }\n\n /* istanbul ignore if */\n if (!route.uri && !route.uriMatcher) {\n console.warn(\n 'Either a uri or uriMatcher is required when configuring the HTTP interceptor.'\n );\n }\n\n return route.uriMatcher\n ? route.uriMatcher(request.url)\n : testPrimitive(route.uri);\n }\n\n return testPrimitive(route);\n }\n\n /**\n * Tries to match a route from the SDK configuration to the HTTP request.\n * If a match is found, the route configuration is returned.\n *\n * @param request The Http request\n * @param config HttpInterceptorConfig\n */\n private findMatchingRoute(\n request: HttpRequest<any>,\n config: HttpInterceptorConfig\n ): Observable<ApiRouteDefinition | null> {\n return from(config.allowedList).pipe(\n first((route) => this.canAttachToken(route, request), null)\n );\n }\n\n private allowAnonymous(route: ApiRouteDefinition | null, err: any): boolean {\n return (\n !!route &&\n isHttpInterceptorRouteConfig(route) &&\n !!route.allowAnonymous &&\n ['login_required', 'consent_required', 'missing_refresh_token'].includes(\n err.error\n )\n );\n }\n}\n","import { Provider } from '@angular/core';\nimport { Auth0ClientService, Auth0ClientFactory } from './auth.client';\nimport { AuthConfig, AuthConfigService, AuthClientConfig } from './auth.config';\nimport { AuthGuard } from './auth.guard';\nimport { AuthHttpInterceptor } from './auth.interceptor';\nimport { AuthService } from './auth.service';\n\n/**\n * Initialize the authentication system. Configuration can either be specified here,\n * or by calling AuthClientConfig.set (perhaps from an APP_INITIALIZER factory function).\n *\n * Note: Should only be used as of Angular 15, and should not be added to a component's providers.\n *\n * @param config The optional configuration for the SDK.\n *\n * @example\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideAuth0(),\n * ],\n * });\n */\nexport function provideAuth0(config?: AuthConfig): Provider[] {\n return [\n AuthService,\n AuthHttpInterceptor,\n AuthGuard,\n {\n provide: AuthConfigService,\n useValue: config,\n },\n {\n provide: Auth0ClientService,\n useFactory: Auth0ClientFactory.createClient,\n deps: [AuthClientConfig],\n },\n ];\n}\n","import { HttpEvent, HttpRequest } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { AuthGuard } from './auth.guard';\nimport { AuthHttpInterceptor } from './auth.interceptor';\n\n/**\n * Functional AuthGuard to ensure routes can only be accessed when authenticated.\n *\n * Note: Should only be used as of Angular 15\n *\n * @param route Contains the information about a route associated with a component loaded in an outlet at a particular moment in time.\n * @param state Represents the state of the router at a moment in time.\n * @returns An Observable, indicating if the route can be accessed or not\n */\nexport const authGuardFn = (\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n) => inject(AuthGuard).canActivate(route, state);\n\n/**\n * Functional AuthHttpInterceptor to include the access token in matching requests.\n *\n * Note: Should only be used as of Angular 15\n *\n * @param req An outgoing HTTP request with an optional typed body.\n * @param handle Represents the next interceptor in an interceptor chain, or the real backend if there are no\n * further interceptors.\n * @returns An Observable representing the intercepted HttpRequest\n */\nexport const authHttpInterceptorFn = (\n req: HttpRequest<any>,\n handle: (req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>\n) => inject(AuthHttpInterceptor).intercept(req, { handle });\n","/*\n * Public API Surface of auth0-angular\n */\n\nexport * from './lib/auth.service';\nexport * from './lib/auth.module';\nexport * from './lib/auth.guard';\nexport * from './lib/auth.interceptor';\nexport * from './lib/auth.config';\nexport * from './lib/auth.client';\nexport * from './lib/auth.state';\nexport * from './lib/interfaces';\nexport * from './lib/provide';\nexport * from './lib/functional';\nexport * from './lib/abstract-navigator';\n\nexport {\n AuthorizationParams,\n PopupLoginOptions,\n PopupConfigOptions,\n GetTokenWithPopupOptions,\n GetTokenSilentlyOptions,\n ICache,\n Cacheable,\n LocalStorageCache,\n InMemoryCache,\n IdToken,\n User,\n GenericError,\n TimeoutError,\n MfaRequiredError,\n PopupTimeoutError,\n AuthenticationError,\n PopupCancelledError,\n MissingRefreshTokenError,\n Fetcher,\n FetcherConfig,\n CustomFetchMinimalOutput,\n UseDpopNonceError,\n} from '@auth0/auth0-spa-js';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.AuthClientConfig","i2.AbstractNavigator","i3.AuthState","i1.AuthService","i2.AuthState","i3.AuthService"],"mappings":";;;;;;;;;;AAAA,gBAAe,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,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,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,kBAAkB;YAC3B,UAAU,EAAE,kBAAkB,CAAC,YAAY;YAC3C,IAAI,EAAE,CAAC,gBAAgB,CAAC;AACzB,SAAA;KACF,CAAC;AACJ;;AC9BA;;;;;;;;AAQG;MACU,WAAW,GAAG,CACzB,KAA6B,EAC7B,KAA0B,KACvB,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE;AAEjD;;;;;;;;;AASG;AACU,MAAA,qBAAqB,GAAG,CACnC,GAAqB,EACrB,MAAqE,KAClE,MAAM,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE;;AClC1D;;AAEG;;ACFH;;AAEG;;;;"}
@@ -18,7 +18,7 @@ export declare const enum HttpMethod {
18
18
  * - an object of type HttpInterceptorRouteConfig
19
19
  * - a string
20
20
  */
21
- export declare type ApiRouteDefinition = HttpInterceptorRouteConfig | string;
21
+ export type ApiRouteDefinition = HttpInterceptorRouteConfig | string;
22
22
  /**
23
23
  * A custom type guard to help identify route definitions that are actually HttpInterceptorRouteConfig types.
24
24
  *
@@ -1,8 +1,8 @@
1
- import { ActivatedRouteSnapshot, RouterStateSnapshot, CanActivate, CanLoad, Route, UrlSegment, CanActivateChild } from '@angular/router';
1
+ import { ActivatedRouteSnapshot, RouterStateSnapshot, Route, UrlSegment } from '@angular/router';
2
2
  import { Observable } from 'rxjs';
3
3
  import { AuthService } from './auth.service';
4
4
  import * as i0 from "@angular/core";
5
- export declare class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
5
+ export declare class AuthGuard {
6
6
  private auth;
7
7
  constructor(auth: AuthService);
8
8
  canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { Auth0Client, PopupLoginOptions, PopupConfigOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, RedirectLoginResult, GetTokenSilentlyVerboseResponse } from '@auth0/auth0-spa-js';
2
+ import { Auth0Client, PopupLoginOptions, PopupConfigOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, RedirectLoginResult, GetTokenSilentlyVerboseResponse, ConnectAccountRedirectResult, CustomFetchMinimalOutput, Fetcher, FetcherConfig } from '@auth0/auth0-spa-js';
3
3
  import { Observable } from 'rxjs';
4
4
  import { AbstractNavigator } from './abstract-navigator';
5
5
  import { AuthClientConfig, AppState } from './auth.config';
@@ -131,7 +131,67 @@ export declare class AuthService<TAppState extends AppState = AppState> implemen
131
131
  *
132
132
  * @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.
133
133
  */
134
- handleRedirectCallback(url?: string): Observable<RedirectLoginResult<TAppState>>;
134
+ handleRedirectCallback(url?: string): Observable<RedirectLoginResult<TAppState> | ConnectAccountRedirectResult<TAppState>>;
135
+ /**
136
+ * ```js
137
+ * getDpopNonce(id).subscribe(nonce => ...)
138
+ * ```
139
+ *
140
+ * Gets the DPoP nonce for the specified domain or the default domain.
141
+ * The nonce is used in DPoP proof generation for token binding.
142
+ *
143
+ * @param id Optional identifier for the domain. If not provided, uses the default domain.
144
+ * @returns An Observable that emits the DPoP nonce string or undefined if not available.
145
+ */
146
+ getDpopNonce(id?: string): Observable<string | undefined>;
147
+ /**
148
+ * ```js
149
+ * setDpopNonce(nonce, id).subscribe(() => ...)
150
+ * ```
151
+ *
152
+ * Sets the DPoP nonce for the specified domain or the default domain.
153
+ * This is typically used after receiving a new nonce from the authorization server.
154
+ *
155
+ * @param nonce The DPoP nonce value to set.
156
+ * @param id Optional identifier for the domain. If not provided, uses the default domain.
157
+ * @returns An Observable that completes when the nonce is set.
158
+ */
159
+ setDpopNonce(nonce: string, id?: string): Observable<void>;
160
+ /**
161
+ * ```js
162
+ * generateDpopProof(params).subscribe(proof => ...)
163
+ * ```
164
+ *
165
+ * Generates a DPoP (Demonstrating Proof-of-Possession) proof JWT.
166
+ * This proof is used to bind access tokens to a specific client, providing
167
+ * an additional layer of security for token usage.
168
+ *
169
+ * @param params Configuration for generating the DPoP proof
170
+ * @param params.url The URL of the resource server endpoint
171
+ * @param params.method The HTTP method (e.g., 'GET', 'POST')
172
+ * @param params.nonce Optional DPoP nonce from the authorization server
173
+ * @param params.accessToken The access token to bind to the proof
174
+ * @returns An Observable that emits the generated DPoP proof as a JWT string.
175
+ */
176
+ generateDpopProof(params: {
177
+ url: string;
178
+ method: string;
179
+ nonce?: string;
180
+ accessToken: string;
181
+ }): Observable<string>;
182
+ /**
183
+ * ```js
184
+ * const fetcher = createFetcher(config);
185
+ * ```
186
+ *
187
+ * Creates a custom fetcher instance that can be used to make authenticated
188
+ * HTTP requests. The fetcher automatically handles token refresh and can
189
+ * be configured with custom request/response handling.
190
+ *
191
+ * @param config Optional configuration for the fetcher
192
+ * @returns A Fetcher instance configured with the Auth0 client.
193
+ */
194
+ createFetcher<TOutput extends CustomFetchMinimalOutput = Response>(config?: FetcherConfig<TOutput>): Fetcher<TOutput>;
135
195
  private shouldHandleCallback;
136
196
  static ɵfac: i0.ɵɵFactoryDeclaration<AuthService<any>, never>;
137
197
  static ɵprov: i0.ɵɵInjectableDeclaration<AuthService<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/auth0-angular",
3
- "version": "2.2.3",
3
+ "version": "2.4.0",
4
4
  "description": "Auth0 SDK for Angular Single Page Applications (SPA)",
5
5
  "keywords": [
6
6
  "auth0",
@@ -30,23 +30,17 @@
30
30
  "@auth0/auth0-spa-js": "^2.0.1"
31
31
  },
32
32
  "schematics": "./schematics/collection.json",
33
- "module": "fesm2015/auth0-auth0-angular.mjs",
34
- "es2020": "fesm2020/auth0-auth0-angular.mjs",
35
- "esm2020": "esm2020/auth0-auth0-angular.mjs",
36
- "fesm2020": "fesm2020/auth0-auth0-angular.mjs",
37
- "fesm2015": "fesm2015/auth0-auth0-angular.mjs",
38
- "typings": "auth0-auth0-angular.d.ts",
33
+ "module": "fesm2022/auth0-auth0-angular.mjs",
34
+ "typings": "index.d.ts",
39
35
  "exports": {
40
36
  "./package.json": {
41
37
  "default": "./package.json"
42
38
  },
43
39
  ".": {
44
- "types": "./auth0-auth0-angular.d.ts",
45
- "esm2020": "./esm2020/auth0-auth0-angular.mjs",
46
- "es2020": "./fesm2020/auth0-auth0-angular.mjs",
47
- "es2015": "./fesm2015/auth0-auth0-angular.mjs",
48
- "node": "./fesm2015/auth0-auth0-angular.mjs",
49
- "default": "./fesm2020/auth0-auth0-angular.mjs"
40
+ "types": "./index.d.ts",
41
+ "esm2022": "./esm2022/auth0-auth0-angular.mjs",
42
+ "esm": "./esm2022/auth0-auth0-angular.mjs",
43
+ "default": "./fesm2022/auth0-auth0-angular.mjs"
50
44
  }
51
45
  },
52
46
  "sideEffects": false
package/public-api.d.ts CHANGED
@@ -9,4 +9,4 @@ export * from './lib/interfaces';
9
9
  export * from './lib/provide';
10
10
  export * from './lib/functional';
11
11
  export * from './lib/abstract-navigator';
12
- export { AuthorizationParams, PopupLoginOptions, PopupConfigOptions, GetTokenWithPopupOptions, GetTokenSilentlyOptions, ICache, Cacheable, LocalStorageCache, InMemoryCache, IdToken, User, GenericError, TimeoutError, MfaRequiredError, PopupTimeoutError, AuthenticationError, PopupCancelledError, MissingRefreshTokenError, } from '@auth0/auth0-spa-js';
12
+ export { AuthorizationParams, PopupLoginOptions, PopupConfigOptions, GetTokenWithPopupOptions, GetTokenSilentlyOptions, ICache, Cacheable, LocalStorageCache, InMemoryCache, IdToken, User, GenericError, TimeoutError, MfaRequiredError, PopupTimeoutError, AuthenticationError, PopupCancelledError, MissingRefreshTokenError, Fetcher, FetcherConfig, CustomFetchMinimalOutput, UseDpopNonceError, } from '@auth0/auth0-spa-js';
@@ -1,35 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "@angular/common";
5
- export class AbstractNavigator {
6
- constructor(location, injector) {
7
- this.location = location;
8
- try {
9
- this.router = injector.get(Router);
10
- }
11
- catch { }
12
- }
13
- /**
14
- * Navigates to the specified url. The router will be used if one is available, otherwise it falls back
15
- * to `window.history.replaceState`.
16
- *
17
- * @param url The url to navigate to
18
- */
19
- navigateByUrl(url) {
20
- if (this.router) {
21
- this.router.navigateByUrl(url);
22
- return;
23
- }
24
- this.location.replaceState(url);
25
- }
26
- }
27
- AbstractNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, deps: [{ token: i1.Location }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
28
- AbstractNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, providedIn: 'root' });
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AbstractNavigator, decorators: [{
30
- type: Injectable,
31
- args: [{
32
- providedIn: 'root',
33
- }]
34
- }], ctorParameters: function () { return [{ type: i1.Location }, { type: i0.Injector }]; } });
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJzdHJhY3QtbmF2aWdhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYXV0aDAtYW5ndWxhci9zcmMvbGliL2Fic3RyYWN0LW5hdmlnYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFZLE1BQU0sZUFBZSxDQUFDO0FBQ3JELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQzs7O0FBTXpDLE1BQU0sT0FBTyxpQkFBaUI7SUFHNUIsWUFBb0IsUUFBa0IsRUFBRSxRQUFrQjtRQUF0QyxhQUFRLEdBQVIs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GVyKTtcbiAgICB9IGNhdGNoIHt9XG4gIH1cblxuICAvKipcbiAgICogTmF2aWdhdGVzIHRvIHRoZSBzcGVjaWZpZWQgdXJsLiBUaGUgcm91dGVyIHdpbGwgYmUgdXNlZCBpZiBvbmUgaXMgYXZhaWxhYmxlLCBvdGhlcndpc2UgaXQgZmFsbHMgYmFja1xuICAgKiB0byBgd2luZG93Lmhpc3RvcnkucmVwbGFjZVN0YXRlYC5cbiAgICpcbiAgICogQHBhcmFtIHVybCBUaGUgdXJsIHRvIG5hdmlnYXRlIHRvXG4gICAqL1xuICBuYXZpZ2F0ZUJ5VXJsKHVybDogc3RyaW5nKTogdm9pZCB7XG4gICAgaWYgKHRoaXMucm91dGVyKSB7XG4gICAgICB0aGlzLnJvdXRlci5uYXZpZ2F0ZUJ5VXJsKHVybCk7XG5cbiAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICB0aGlzLmxvY2F0aW9uLnJlcGxhY2VTdGF0ZSh1cmwpO1xuICB9XG59XG4iXX0=
@@ -1,23 +0,0 @@
1
- import { InjectionToken, VERSION } from '@angular/core';
2
- import { Auth0Client } from '@auth0/auth0-spa-js';
3
- import useragent from '../useragent';
4
- export class Auth0ClientFactory {
5
- static createClient(configFactory) {
6
- const config = configFactory.get();
7
- if (!config) {
8
- throw new Error('Configuration must be specified either through AuthModule.forRoot or through AuthClientConfig.set');
9
- }
10
- return new Auth0Client({
11
- ...config,
12
- auth0Client: {
13
- name: useragent.name,
14
- version: useragent.version,
15
- env: {
16
- 'angular/core': VERSION.full,
17
- },
18
- },
19
- });
20
- }
21
- }
22
- export const Auth0ClientService = new InjectionToken('auth0.client');
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aC5jbGllbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9hdXRoMC1hbmd1bGFyL3NyYy9saWIvYXV0aC5jbGllbnQudH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