Skip to content

Commit

Permalink
OAuth login failed: No profile hoarder-app#410
Browse files Browse the repository at this point in the history
using email address as fallback, if the name is not available
  • Loading branch information
kamtschatka committed Sep 23, 2024
1 parent fb0336b commit 023dc44
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 023dc44

Please sign in to comment.