Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: note about sub from oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 4, 2023
1 parent bb00027 commit 9b154e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export const authOptions = {
async session({ session, token }) {
await connectMongo();
// Send properties to the client, like an access_token and user id from a provider.
// note: `sub` is the user id
session.accessToken = token.accessToken;
session.user.id = token.id;
session.user.id = token.sub;
session.username = token.username;
const user = await User.findOne({ _id: token.sub });
if (user) {
Expand Down

0 comments on commit 9b154e9

Please sign in to comment.