Skip to content

Commit a36299c

Browse files
committed
Remove problematic customization of session callback
The customization was suppose to only add "id" to the "user" object of the session callback response (exposed via /api/auth/session), but when this customization is added, the callback also starts returning otherwise secret information - namely the "sessionToken". This is a problem because the session token is suppose to only be stored in an HttpOnly cookie in the browser and on the server side, making it inaccessible to JavaScript. But with the /api/auth/session endpoint returning the session token it is easily accessible from JavaScript by doing a network request.
1 parent 9bcdd4d commit a36299c

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/composition.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ export const { signIn, auth, handlers: authHandlers } = NextAuth({
109109
async signIn({ user, account }) {
110110
return await logInHandler.handleLogIn({ user, account })
111111
},
112-
async session({ session, user }) {
113-
session.user.id = user.id
114-
return session
115-
}
116112
}
117113
})
118114

0 commit comments

Comments
 (0)