Repository navigation
feat: add DPoP support with fetcher API - #500
Merged
Merged
Conversation
- Update @auth0/auth0-spa-js dependency to v2.10.0 - Fix handleRedirectCallback return type to include ConnectAccountRedirectResult - Import ConnectAccountRedirectResult type from spa-js - Add TextEncoder/TextDecoder polyfills in jest.setup.js for Node.js test environment - Configure Jest to use setup file for polyfills The handleRedirectCallback method now returns a union type that includes ConnectAccountRedirectResult to support the new connect account flow introduced in spa-js v2.10.0. The TextEncoder/TextDecoder polyfills are required because spa-js v2.10.0 uses these Web APIs for DPoP functionality, which are not available in Node.js test environment by default.
yogeshchoudhary147
force-pushed
the
feat/dpop-support
branch
from
December 3, 2025 14:04
b57edd0 to
ad6553a
Compare
- Add getDpopNonce() method to retrieve DPoP nonces - Add setDpopNonce() method to store DPoP nonces - Add generateDpopProof() method to generate DPoP proof JWTs - Add createFetcher() method for automatic authenticated API requests - Export FetcherConfig, Fetcher, CustomFetchMinimalOutput types - Export UseDpopNonceError for error handling - Add comprehensive JSDoc documentation for all new methods - Add unit tests for all new DPoP methods DPoP (Demonstrating Proof-of-Possession) cryptographically binds access tokens to a specific client, preventing token theft and replay attacks. The createFetcher() method is the recommended way to make authenticated API calls, as it automatically handles token retrieval, DPoP proof generation, nonce management, and retry logic.
yogeshchoudhary147
force-pushed
the
feat/dpop-support
branch
from
December 3, 2025 14:44
ad6553a to
9ce6c05
Compare
| ); | ||
| } | ||
|
|
||
| async getDpopNonce(id?: string): Promise<string | undefined> { |
Contributor
There was a problem hiding this comment.
Hey @yogeshchoudhary147 shouldn't the new async dpop related methods use the proxy pattern.
I see It is used to wrap every single asynchronous method that interacts with the Auth0 Client.
async getDpopNonce(id?: string) {
return this.__proxy(() =>
this._client.getDpopNonce(id)
);
}
Contributor
Author
There was a problem hiding this comment.
Good catch. I've added the __proxy wrapper.
- Wrap getDpopNonce, setDpopNonce, and generateDpopProof with __proxy - Add error tracking tests for all three async DPoP methods - Add error clearing test to verify successful calls clear errors - Ensures consistent error handling and loading state management - Maintains consistency with existing async methods pattern
gyaneshgouraw
approved these changes
Dec 11, 2025
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 TextEncoder/TextDecoder polyfills
jest.setup.js- 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