Skip to content

Commit

Permalink
fix(auth):🐛explicitly set linkAccount user values
Browse files Browse the repository at this point in the history
, #10
  • Loading branch information
laurin-wolf authored and baptisteArno committed Apr 20, 2022
1 parent bdd7a17 commit 97b14f1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/builder/pages/api/auth/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@ export function CustomAdapter(p: PrismaClient): Adapter {
},
updateUser: (data) => p.user.update({ where: { id: data.id }, data }),
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) =>
p.account.delete({ where: { provider_providerAccountId } }) as any,
async getSessionAndUser(sessionToken) {
Expand Down

0 comments on commit 97b14f1

Please sign in to comment.