-
Notifications
You must be signed in to change notification settings - Fork 413
v4.1: Overridden user details in Auth0Provider are ignored when retrieving user details with useUser() #1993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you elaborate on the use-case for this? Why would you not be able to rely on the actual values, rather than override them? |
Please see https://github.com/auth0/nextjs-auth0/blob/main/EXAMPLES.md#passing-an-initial-user-from-the-server
V4 does not override, it provides a fallback. Is this similar to what you are facing? |
That's correct, I was expecting it to behave like v3 and override the user, but I wasn't aware of the different behaviour in v4. |
@frederikprijck Apologies for the delayed response. We need to use our internal user ID instead of the Auth0 one, and then retrieve the rest of the user data from Auth0. |
This is something to be solved in an action to enrich the token with whatever additional claim you want. |
Checklist
Description
Hi,
In v3, we could easily override user details by updating the user prop within
<UserProvider />
. For example:Then in client components, we could then access the overridden user details via
useUser()
.However, in v4, even though we set the user={{ sub, email, name }} prop in
<Auth0Provider />
,useUser()
ignores these overridden details and instead returns the defaultsession.user
details.Reproduction
Auth0Provider
with test data:useUser()
:Additional context
No response
nextjs-auth0 version
4.1.0
Next.js version
14.2.25
Node.js version
18.19.0
The text was updated successfully, but these errors were encountered: