Draft
Conversation
🚀 Preview deploymentBranch: 📝 Preview URL: https://auth0-universal-components-ent3b7mxy-okta.vercel.app Updated at 2026-01-26T19:49:19.783Z |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64 +/- ##
==========================================
+ Coverage 83.62% 83.64% +0.02%
==========================================
Files 125 125
Lines 10320 10336 +16
Branches 1092 1029 -63
==========================================
+ Hits 8630 8646 +16
Misses 1690 1690 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rax7389
reviewed
Jan 27, 2026
Comment on lines
+23
to
+25
| const fetcher = customFetch | ||
| ? customFetch | ||
| : async (url: string, init?: RequestInit) => { |
Contributor
There was a problem hiding this comment.
just a small thing we should use ?? to avoid this redundant checking pattern
| } else if (auth.domain) { | ||
| const fetcher = async (url: string, init?: RequestInit) => { | ||
| const token = await tokenManagerService.getToken(latestScopes, 'me'); | ||
| const fetcher = customFetch |
| }, | ||
| }); | ||
| }; | ||
| const fetcher = customFetch |
Contributor
There was a problem hiding this comment.
similar changes for this provider
|
|
||
| import type { I18nServiceInterface } from '../i18n'; | ||
|
|
||
| export type CustomFetch = (url: string, init?: RequestInit | undefined) => Promise<Response>; |
Member
There was a problem hiding this comment.
Why not the same as SPA-JS?
info: RequestInfo | URL,
init?: RequestInit,
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.
Changes
Context
At this moment DPoP is not supported in Components for SPA and we should not be responsible to create or manage this, because we should just relay on the auth SDKs that already manage all the authentication process.
As a first step, we should allow users to pass their own custom fetcher so they can create a fetcher by using the auth SDKs, like
auth0-spa-js(https://github.com/auth0/auth0-spa-js/blob/main/EXAMPLES.md#using-dpop-in-your-own-requests) orauth0-react(https://github.com/auth0/auth0-react/blob/main/EXAMPLES.md#enabling-dpop), and then they can reuse the same fetcher into Universal Components.Next step, not in this PR:
As a second step, we should be able to get the current instance of the fetcher that the
auth0-reactis using from theuseAuth0hook, but the problem is that at this momentuseAuth0only expose thecreateFetcherfunction to allow users to create fetchers, not an instance itself.We are opening conversations about how we can inherit this fetcher directly from
auth0-reactby using theuseAuth0hook, maybeauth0-reactmust instantiate it's own fetcher instead of exposingcreateFetcheror maybe we should just create a new fetcher using this method.PR implementation
This PR adds a new
customFetchproperty intospa-providerandproxy-providerto support custom fetcher for API requests in the different SDK available in CoreClient (MyOrganization and MyAccount).In addition, it updates the documentation to include the new prop.
References
Testing
pnpm run buildexamplesappAuth0ComponentProvideris been used and pass a new function using thecustomFetchprop.examplesappChecklist