Skip to content

Commit 2bfce0d

Browse files
authored
Merge pull request #435 from shapehq/remove-session-customization
2 parents 9bcdd4d + 7e7777d commit 2bfce0d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/composition.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,18 @@ export const { signIn, auth, handlers: authHandlers } = NextAuth({
110110
return await logInHandler.handleLogIn({ user, account })
111111
},
112112
async session({ session, user }) {
113-
session.user.id = user.id
114-
return session
113+
// Construct a new session object conforming to DefaultSession
114+
// If "session" is returned it will include everything from AdapterSession,
115+
// which is critical as this contains the sessionToken
116+
return {
117+
user: {
118+
id: user.id,
119+
email: user.email,
120+
name: user.name,
121+
image: user.image
122+
},
123+
expires: session.expires,
124+
}
115125
}
116126
}
117127
})

0 commit comments

Comments
 (0)