Skip to content

Commit

Permalink
docs: update session callback (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge authored Oct 1, 2023
1 parent bab7e6e commit b5c663d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions www/src/pages/en/usage/next-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}),
},
};
```
Expand Down

2 comments on commit b5c663d

@vercel
Copy link

@vercel vercel bot commented on b5c663d Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on b5c663d Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

t3-upgrade – ./upgrade

t3-upgrade-t3-oss.vercel.app
t3-upgrade-git-next-t3-oss.vercel.app
t3-upgrade.vercel.app

Please sign in to comment.