From e1feeceda475b117dde99a971f87e20a149f7edf Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Mon, 23 Sep 2024 22:53:41 +0200 Subject: fix(web): Change names to be optional when signing up via SSO. #410 (#412) using email address as fallback, if the name is not available --- apps/web/server/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/web/server/auth.ts b/apps/web/server/auth.ts index 483d1522..042be1ae 100644 --- a/apps/web/server/auth.ts +++ b/apps/web/server/auth.ts @@ -114,7 +114,7 @@ if (oauth.wellKnownUrl) { ]); return { id: profile.sub, - name: profile.name, + name: profile.name || profile.email, email: profile.email, image: profile.picture, role: admin || firstUser ? "admin" : "user", @@ -146,7 +146,7 @@ export const authOptions: NextAuthOptions = { if (credentials) { return true; } - if (!profile?.email || !profile?.name) { + if (!profile?.email) { throw new Error("No profile"); } const [{ count: userCount }] = await db -- cgit v1.2.3-70-g09d2