Zefty
Zefty
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
Something like this (i'm using drizzle) ^
9 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
session: async ({ session, user }) => {
let acc = await db.query.accounts.findFirst({
where: eq(accounts.userId, user.id),
});

return {
...session,
user: {
...session.user,
id: user.id,
},
accessToken: acc?.access_token,
};
}
session: async ({ session, user }) => {
let acc = await db.query.accounts.findFirst({
where: eq(accounts.userId, user.id),
});

return {
...session,
user: {
...session.user,
id: user.id,
},
accessToken: acc?.access_token,
};
}
9 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
Then in your session callback you can add a primsa call to db to fetch tokens and etc
9 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
Hey, i've done something very similar to you for my app I noticed you have db adapter so you may have to use database strategy for the session instead of jwt
9 replies