From 5ba94de9c9965327acbf6c1dc8d8f9715ef4c5f0 Mon Sep 17 00:00:00 2001 From: Shahar Glazner Date: Tue, 9 Apr 2024 09:01:21 +0300 Subject: [PATCH] fix: name (#1074) --- keep-ui/pages/api/auth/[...nextauth].ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keep-ui/pages/api/auth/[...nextauth].ts b/keep-ui/pages/api/auth/[...nextauth].ts index a3cb6a6c2..d3ea97ecb 100644 --- a/keep-ui/pages/api/auth/[...nextauth].ts +++ b/keep-ui/pages/api/auth/[...nextauth].ts @@ -56,6 +56,14 @@ const multiTenantAuthOptions = { if ((profile as any)?.given_name) { const givenName = (profile as any).given_name; token.name = givenName; + } else if ((profile as any)?.name) { + // split by " " and take the first part + const name = (profile as any).name as string; + const nameParts = name.split(" "); + // verify that the name is not empty (should not happen, but just in case) + if (nameParts.length > 0){ + token.name = nameParts[0]; + } }