From ef5b9d775771afdfc2fcc4830a177a74bcd6e218 Mon Sep 17 00:00:00 2001 From: Keith Stevens Date: Sat, 4 Feb 2023 16:18:19 +0900 Subject: [PATCH] Fixing the way we generate the backenduser object during jwt creation (#1090) --- website/src/pages/api/auth/[...nextauth].ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/src/pages/api/auth/[...nextauth].ts b/website/src/pages/api/auth/[...nextauth].ts index d56868f8..d75422a4 100644 --- a/website/src/pages/api/auth/[...nextauth].ts +++ b/website/src/pages/api/auth/[...nextauth].ts @@ -112,8 +112,9 @@ const authOptions: AuthOptions = { select: { name: true, role: true, isNew: true, accounts: true, id: true }, }); + // Note: This could be cleaner and merged with src/lib/users.ts const user: BackendUserCore = { - id, + id: accounts.length > 0 ? accounts[0].providerAccountId : id, display_name: name, auth_method: accounts.length > 0 ? accounts[0].provider : "local", };