Skip to content

Commit

Permalink
fix(web): Change names to be optional when signing up via SSO. hoarde…
Browse files Browse the repository at this point in the history
…r-app#410 (hoarder-app#412)

using email address as fallback, if the name is not available
  • Loading branch information
kamtschatka authored Sep 23, 2024
1 parent fb0336b commit e1feece
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/web/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e1feece

Please sign in to comment.