You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Standalone Components and a more functional approach](#standalone-components-and-a-more-functional-approach)
12
13
13
14
## Add login to your application
@@ -157,7 +158,7 @@ import { AuthModule } from '@auth0/auth0-angular';
157
158
clientId: 'YOUR_AUTH0_CLIENT_ID',
158
159
authorizationParams: {
159
160
audience: 'YOUR_AUTH0_API_IDENTIFIER',
160
-
}
161
+
},
161
162
}),
162
163
],
163
164
// ...
@@ -278,7 +279,7 @@ AuthModule.forRoot({
278
279
authorizationParams: {
279
280
audience: 'http://my-api/',
280
281
scope: 'write:orders',
281
-
}
282
+
},
282
283
},
283
284
},
284
285
],
@@ -380,7 +381,266 @@ export class AppComponent {
380
381
}
381
382
```
382
383
384
+
## DPoP (Demonstrating Proof-of-Possession)
385
+
386
+
[DPoP](https://datatracker.ietf.org/doc/html/rfc9449) is a security mechanism that cryptographically binds access tokens to clients, providing protection against:
387
+
388
+
- **Token Theft** - Stolen tokens are cryptographically bound and unusable by attackers
389
+
- **Replay Attacks** - Tokens are tied to specific HTTP requests
390
+
- **Token Exfiltration** - Tokens require the client's private key to use
391
+
392
+
### Enable DPoP
393
+
394
+
To enable DPoP support, set `useDpop:true` in your Auth0 configuration:
395
+
396
+
```ts
397
+
import { NgModule } from'@angular/core';
398
+
import { AuthModule } from'@auth0/auth0-angular';
399
+
400
+
@NgModule({
401
+
imports: [
402
+
AuthModule.forRoot({
403
+
domain: 'YOUR_AUTH0_DOMAIN',
404
+
clientId: 'YOUR_AUTH0_CLIENT_ID',
405
+
authorizationParams: {
406
+
redirect_uri: window.location.origin,
407
+
audience: 'https://api.example.com',
408
+
},
409
+
useDpop: true, // Enable DPoP
410
+
}),
411
+
],
412
+
})
413
+
exportclassAppModule {}
414
+
```
415
+
416
+
### Using createFetcher (Recommended)
417
+
418
+
The simplest way to make authenticated API calls with DPoP is using the `createFetcher` method. It automatically handles tokens, DPoP proofs, and nonce management:
## Standalone components and a more functional approach
643
+
384
644
As of Angular 15, the Angular team is putting standalone components, as well as a more functional approach, in favor of the traditional use of NgModules and class-based approach.
385
645
386
646
There are a couple of difference with how you would traditionally implement our SDK:
@@ -398,17 +658,11 @@ const routes: Routes = [
398
658
path: 'profile',
399
659
component: ProfileComponent,
400
660
canActivate: [authGuardFn],
401
-
}
661
+
},
402
662
];
403
663
404
664
bootstrapApplication(AppComponent, {
405
-
providers: [
406
-
provideRouter(routes),
407
-
provideAuth0(/* Auth Config Goes Here */),
408
-
provideHttpClient(
409
-
withInterceptors([authHttpInterceptorFn])
410
-
)
411
-
]
665
+
providers: [provideRouter(routes), provideAuth0(/* Auth Config Goes Here */), provideHttpClient(withInterceptors([authHttpInterceptorFn]))],
0 commit comments