solve mail backend 6
This commit is contained in:
parent
eba4df1e4d
commit
97068d5f6d
@ -195,6 +195,31 @@ export const authOptions: NextAuthOptions = {
|
||||
throw new Error("RefreshAccessTokenError");
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Creating/updating user in session callback:', {
|
||||
id: token.sub,
|
||||
email: token.email
|
||||
});
|
||||
|
||||
// Create or update user in local database
|
||||
await prisma.user.upsert({
|
||||
where: { id: token.sub as string },
|
||||
update: {
|
||||
email: token.email as string,
|
||||
password: '', // We don't store password for Keycloak users
|
||||
},
|
||||
create: {
|
||||
id: token.sub as string,
|
||||
email: token.email as string,
|
||||
password: '', // We don't store password for Keycloak users
|
||||
},
|
||||
});
|
||||
|
||||
console.log('User created/updated successfully');
|
||||
} catch (error) {
|
||||
console.error('Error creating/updating user in session callback:', error);
|
||||
}
|
||||
|
||||
session.accessToken = token.accessToken;
|
||||
session.user = {
|
||||
id: token.sub as string,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user