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
docs: Restructure DPoP examples to match auth0-react pattern
- Change section title to 'Device-bound tokens with DPoP'
- Add detailed intro explaining DPoP security benefits
- Document browser API requirements (Crypto API, IndexedDB)
- List supported OAuth 2.0 flows
- Add important callouts about ES256, new sessions, and sender constraining
- Reorganize content to match auth0-react structure
- Move manual DPoP management under Advanced usage subsection
- Add clearer progression from simple to advanced usage
-[Device-bound tokens with DPoP](#device-bound-tokens-with-dpop)
12
12
-[Standalone Components and a more functional approach](#standalone-components-and-a-more-functional-approach)
13
13
-[Connect Accounts for using Token Vault](#connect-accounts-for-using-token-vault)
14
14
@@ -382,17 +382,30 @@ export class AppComponent {
382
382
}
383
383
```
384
384
385
-
## DPoP (Demonstrating Proof-of-Possession)
385
+
## Device-bound tokens with DPoP
386
386
387
-
[DPoP](https://datatracker.ietf.org/doc/html/rfc9449) is a security mechanism that cryptographically binds access tokens to clients, providing protection against:
387
+
**Demonstrating Proof-of-Possession** —or simply **DPoP**— is a recent OAuth 2.0 extension defined in [RFC9449](https://datatracker.ietf.org/doc/html/rfc9449).
388
388
389
-
- **Token Theft** - Stolen tokens are cryptographically bound and unusable by attackers
390
-
- **Replay Attacks** - Tokens are tied to specific HTTP requests
391
-
- **Token Exfiltration** - Tokens require the client's private key to use
389
+
It defines a mechanism for securely binding tokens to a specific device using cryptographic signatures. Without it, **a token leak caused by XSS or other vulnerabilities could allow an attacker to impersonate the real user.**
392
390
393
-
### Enable DPoP
391
+
To support DPoP in `auth0-angular`, some APIs available in modern browsers are required:
394
392
395
-
To enable DPoP support, set `useDpop:true` in your Auth0 configuration:
393
+
- [Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Crypto): allows to create and use cryptographic keys, which are used to generate the proofs (i.e. signatures) required for DPoP.
394
+
395
+
- [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API): enables the use of cryptographic keys [without exposing the private material](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto#storing_keys).
396
+
397
+
The following OAuth 2.0 flows are currently supported by `auth0-angular`:
> Currently, only the `ES256` algorithm is supported.
405
+
406
+
### Enabling DPoP
407
+
408
+
DPoP is disabled by default. To enable it, set the `useDpop` option to `true` when configuring the SDK. For example:
396
409
397
410
```ts
398
411
import { NgModule } from'@angular/core';
@@ -403,82 +416,167 @@ import { AuthModule } from '@auth0/auth0-angular';
403
416
AuthModule.forRoot({
404
417
domain: 'YOUR_AUTH0_DOMAIN',
405
418
clientId: 'YOUR_AUTH0_CLIENT_ID',
419
+
useDpop: true, // 👈
406
420
authorizationParams: {
407
421
redirect_uri: window.location.origin,
408
-
audience: 'https://api.example.com',
409
422
},
410
-
useDpop: true, // Enable DPoP
411
423
}),
412
424
],
413
425
})
414
426
exportclassAppModule {}
415
427
```
416
428
417
-
### Using createFetcher (Recommended)
429
+
After enabling DPoP, **every new session using a supported OAuth 2.0 flow in Auth0 will begin transparently to use tokens that are cryptographically bound to the current browser**.
430
+
431
+
> [!IMPORTANT]
432
+
> DPoP will only be used for new user sessions created after enabling it. Any previously existing sessions will continue using non-DPoP tokens until the user logs in again.
433
+
>
434
+
> You decide how to handle this transition. For example, you might require users to log in again the next time they use your application.
435
+
436
+
> [!NOTE]
437
+
> Using DPoP requires storing some temporary data in the user's browser. When you log the user out with `logout()`, thisdataisdeleted.
438
+
439
+
> [!TIP]
440
+
>Ifallyourclientsarealreadyusing DPoP, youmaywanttoincreasesecuritybymakingAuth0rejectanynon-DPoPinteractions. See [thedocsonSenderConstraining](https://auth0.com/docs/secure/sender-constraining/configure-sender-constraining) for details.
441
+
442
+
### UsingDPoPinyourownrequests
418
443
419
-
The simplest way to make authenticated API calls with DPoP is using the `createFetcher` method. It automatically handles tokens, DPoP proofs, and nonce management:
> IfDPoPisenabled, a`dpopNonceId` **must** bepresentinthe`createFetcher()`parameters, sinceit's used to keep track of the DPoP nonces for each request.
473
518
474
-
When working with multiple APIs, create separate fetchers for each. Each fetcher manages its own nonces independently:
Yourimplementationwillbecalledwithastandard, ready-to-use [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object, which will contain any headers needed for authorization and DPoP usage (if enabled). Depending on your needs, you can use this object directly or treat it as a container with everything required to make the request your own way.
0 commit comments