Next.js Discord

Discord Forum

NextAuth won't let me include custom username in jwt callback

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
I am attempting to include the username in my token so I can use it with the session data, but it doesn't seem to want to let me include it. I created the next-auth.d.ts file and am still seeing no success. When I print the user object to the console it prints the proper data including the username so I don't see why I can't pass it here. I'm using the credentials provider. Thanks for the help in advance!
Image
Image
Image

3 Replies

Avatar
Barbary LionOP
bump 🙏
Avatar
Sun bear
I think you have to add username to the types User and AdaptUser like you did for Session and Token
Avatar
Barbary LionOP
Hmm ok, will give that a shot tomorrow. Thanks for the idea.