From b5c663db6d326f57eaf2c3efe76c8702cef3d183 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 1 Oct 2023 11:32:00 +0200 Subject: [PATCH] docs: update session callback (#1582) --- www/src/pages/en/usage/next-auth.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/src/pages/en/usage/next-auth.mdx b/www/src/pages/en/usage/next-auth.mdx index b5e3b44f77..cb0830caf5 100644 --- a/www/src/pages/en/usage/next-auth.mdx +++ b/www/src/pages/en/usage/next-auth.mdx @@ -195,15 +195,15 @@ I.e.: + strategy: "jwt", + }, callbacks: { -- session({ session, user }) { -+ session({ session, token }) { -- if (session.user) { -+ if (session.user && token.sub) { -- session.user.id = user.id; -+ session.user.id = token.sub; +- session: ({ session, user }) => ({ ++ session: ({ session, token }) => ({ + ...session, + user: { + ...session.user, +- id: user.id; ++ id: token.sub; } - return session; - } + }), }, }; ```