From 97b14f19f089c2e68f4d88ffbf8b58f1a1633dd2 Mon Sep 17 00:00:00 2001 From: Laurin Wolf Date: Tue, 19 Apr 2022 11:20:16 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix(auth):=F0=9F=90=9Bexplicitly=20set=20li?= =?UTF-8?q?nkAccount=20user=20values=20,=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/builder/pages/api/auth/adapter.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/builder/pages/api/auth/adapter.ts b/apps/builder/pages/api/auth/adapter.ts index 1d26e2888..fbfe938fe 100644 --- a/apps/builder/pages/api/auth/adapter.ts +++ b/apps/builder/pages/api/auth/adapter.ts @@ -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) { From b28fb063293ed4e698daf8a15b72b094cb9519f8 Mon Sep 17 00:00:00 2001 From: Laurin Wolf Date: Wed, 20 Apr 2022 08:58:52 +0200 Subject: [PATCH 2/2] =?UTF-8?q?fix(auth):=20=F0=9F=90=9B=20add=20missing?= =?UTF-8?q?=20account=20attributes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/builder/pages/api/auth/adapter.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/builder/pages/api/auth/adapter.ts b/apps/builder/pages/api/auth/adapter.ts index fbfe938fe..0d680b5a5 100644 --- a/apps/builder/pages/api/auth/adapter.ts +++ b/apps/builder/pages/api/auth/adapter.ts @@ -45,16 +45,20 @@ export function CustomAdapter(p: PrismaClient): Adapter { linkAccount: (data) => { return p.account.create({ data: { - provider: data.provider, + userId: data.userId, type: data.type, + provider: data.provider, providerAccountId: data.providerAccountId, - access_token: data.access_token, - token_type: data.token_type, - expires_at: data.expires_at, refresh_token: data.refresh_token, + access_token: data.access_token, + expires_at: data.expires_at, + token_type: data.token_type, scope: data.scope, id_token: data.id_token, - userId: data.userId, + session_state: data.session_state, + oauth_token_secret: data.oauth_token_secret as string, + oauth_token: data.oauth_token as string, + refresh_token_expires_in: data.refresh_token_expires_in as number, } }) as any },