create-t3-app next auth question

In the default auth settings for t3, I noticed id: token.sub in the callbacks making the id available on the user object. Is this sub something I can use as my unique user/account id in my db? What is sub?

export const authOptions: NextAuthOptions = {
  callbacks: {
    session: ({ session, token }) => ({
      ...session,
      user: {
        ...session.user,
        id: token.sub,
      },
    }),
  },
Solution
GitHub
Question 💬 I am currently working on Nextjs project and using nextAuth for authentication . right now whenever any user completes sign in then the JWT generated has sub property which always contai...
Was this page helpful?