fix(auth): update provider id on sign in

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-12-21 11:12:45 +01:00
parent a32b8b37bd
commit eb2abd6027

View File

@@ -169,6 +169,15 @@ export async function githubCallback(
},
},
});
} else if (existingUser.provider === 'github') {
await db.account.update({
where: {
id: existingUser.id,
},
data: {
providerId: String(githubUserId),
},
});
}
setSessionTokenCookie(
@@ -371,6 +380,15 @@ export async function googleCallback(
},
},
});
} else if (existingAccount.provider === 'google') {
await db.account.update({
where: {
id: existingAccount.id,
},
data: {
providerId: googleId,
},
});
}
setSessionTokenCookie(