alts
alts
Explore posts from servers
TTCTheo's Typesafe Cult
Created by alts on 4/16/2023 in #questions
NextAuth add additional property to session
Hi, I am trying to add "plan" to the session object that I can receive with the useSession() hook. I am using create-t3-app
...
export const authOptions: NextAuthOptions = {
callbacks: {
session: ({ session, user }) => {
console.log({ user, session });
return {
...session,
user: {
...session.user,
plan: user.plan,
id: user.id,
},
};
},
},
...
...
export const authOptions: NextAuthOptions = {
callbacks: {
session: ({ session, user }) => {
console.log({ user, session });
return {
...session,
user: {
...session.user,
plan: user.plan,
id: user.id,
},
};
},
},
...
But it is throwing an typescript error: TS2339: Property 'plan' does not exist on type 'AdapterUser'. It is working fine tough. Any tips?
5 replies