Skip to content

Session Only Has Email - Next Auth Credentials Provider #8966

Answered by rmartin93
rmartin93 asked this question in Help
Discussion options

You must be logged in to vote

I was able to fix the issue with the following callbacks:

	callbacks: {
		async jwt({ token, user }) {
			user && (token.user = user);
			return token;
		},
		async session({ session, token }) {
			// Send properties to the client, like an access_token and user id from a provider.
			session.user = token.user;
			return session;
		},
	},

Maybe I'm not understanding something, but it seems like user shouldn't have been undefined in the first place. If anybody can shed some light on what's happening under the hood / why I had to do these callbacks to make user defined that would be awesome.

If not, no worries.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rmartin93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant