2
0

fix(auth):🐛explicitly set linkAccount user values

, #10
This commit is contained in:
Laurin Wolf
2022-04-19 11:20:16 +02:00
committed by Baptiste Arnaud
parent bdd7a1712e
commit 97b14f19f0

View File

@ -42,7 +42,22 @@ export function CustomAdapter(p: PrismaClient): Adapter {
}, },
updateUser: (data) => p.user.update({ where: { id: data.id }, data }), updateUser: (data) => p.user.update({ where: { id: data.id }, data }),
deleteUser: (id) => p.user.delete({ where: { id } }), deleteUser: (id) => p.user.delete({ where: { id } }),
linkAccount: (data) => p.account.create({ data }) as any, linkAccount: (data) => {
return p.account.create({
data: {
provider: data.provider,
type: data.type,
providerAccountId: data.providerAccountId,
access_token: data.access_token,
token_type: data.token_type,
expires_at: data.expires_at,
refresh_token: data.refresh_token,
scope: data.scope,
id_token: data.id_token,
userId: data.userId,
}
}) as any
},
unlinkAccount: (provider_providerAccountId) => unlinkAccount: (provider_providerAccountId) =>
p.account.delete({ where: { provider_providerAccountId } }) as any, p.account.delete({ where: { provider_providerAccountId } }) as any,
async getSessionAndUser(sessionToken) { async getSessionAndUser(sessionToken) {