`await getUser()` doesn't return the first and last name
In my Next.js App Router application, in a page component, I get the user:
However, the first and last names are undefined:
I double checked on the Kinde User page that the user id and the email are the same and that the first and last names are set there.
What am I missing?
4 Replies
Oh, after logging out and logging in again, the first and last names appeared.
I wonder if it's some sort of caching issue, or is it by design?!
Steps to reproduce:
1. Sign up using a new email address. First and last names will be undefined, as expected.
2. Add first and last name on the user page in the Kinde UI.
3. First and last names are still returned as undefined.
4. Logout and login again. Now the first and last names are returned as expected.
Thanks, we will look into this. Probably not until Monday. Hope it's not a show stopper for you at this stage.
Hey @moroshko,
This experience is as expected as between steps #2 and #3, the claims of the ID token (which include the first name and last name) are not refreshed.
You can refresh the claims of the token using the
getKindeServerSession().refreshTokens()
method.
Let me know if you have any other questions or queries.Makes sense, thanks!