feat: add DPoP support with fetcher API#732
Merged
yogeshchoudhary147 merged 2 commits intomainfrom Dec 22, 2025
Merged
Conversation
- Added cross-fetch polyfill to test-setup.ts to support fetch API in tests - Updated handleRedirectCallback return type to include ConnectAccountRedirectResult - Updated test mocks to support new return types - Required for compatibility with @auth0/auth0-spa-js v2.10.0
- Add getDpopNonce() method to retrieve DPoP nonce for a domain - Add setDpopNonce() method to set DPoP nonce for a domain - Add generateDpopProof() method to generate DPoP proof JWT - Add createFetcher() method to create authenticated HTTP fetcher - Export DPoP-related types: Fetcher, FetcherConfig, CustomFetchMinimalOutput - Export UseDpopNonceError for error handling - Add comprehensive unit tests for all DPoP methods
| url?: string | ||
| ): Observable<RedirectLoginResult<TAppState>> { | ||
| ): Observable< | ||
| RedirectLoginResult<TAppState> | ConnectAccountRedirectResult<AppState> |
Contributor
There was a problem hiding this comment.
Minor pick, should this generic type be ConnectAccountRedirectResult<AppState> as ConnectAccountRedirectResult<TAppState>
Contributor
Author
There was a problem hiding this comment.
Will fix this
gyaneshgouraw-okta
approved these changes
Dec 22, 2025
Contributor
|
@yogeshchoudhary147 We should also update Examples.md file for this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds DPoP (Demonstrating Proof-of-Possession) support by exposing new authentication methods from
@auth0/auth0-spa-jsv2.10.0. DPoP cryptographically binds access tokens to clients, preventing token theft and replay attacks.What is DPoP?
DPoP prevents security vulnerabilities by:
Changes
1. Dependency & Compatibility Updates
⬆️ Upgrade
@auth0/auth0-spa-jsto v2.10.0🔧 Update
handleRedirectCallbackreturn typeConnectAccountRedirectResultto support account linking flows🧪 Add
cross-fetchpolyfilltest-setup.ts- only affects test environment, not production2. New DPoP Methods
getDpopNonce(id?)setDpopNonce(nonce, id?)generateDpopProof(params)createFetcher(config?)3. New Exports
Class:
UseDpopNonceError- DPoP nonce error classTypes:
FetcherConfig- Fetcher configuration optionsFetcher- Fetcher instance typeCustomFetchMinimalOutput- Custom response type constraint4. Documentation & Testing
Usage
Basic Setup
Recommended: Using
createFetcher()⭐The simplest way to make authenticated API calls with DPoP:
What
createFetcher()does automatically:getAccessTokenSilently()Authorizationheaders (DPoP <token>orBearer <token>)DPoPheaderMultiple APIs
Advanced: Manual DPoP Management
For scenarios requiring full control:
Error Handling
Why Use
createFetcher()?createFetcher()Breaking Changes
None - Fully backward compatible:
handleRedirectCallbackreturn type is a union (includes old type)useDpop: trueMigration Guide
Enable DPoP
Update API Calls (Recommended)
Testing
getDpopNonce()with/without IDsetDpopNonce()with/without IDgenerateDpopProof()createFetcher()with/without configRelated
@auth0/auth0-spa-js>= 2.10.0 (included)Checklist