Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 6a1b82d

Browse files
committed
fix: new users no existing token
1 parent 5efc804 commit 6a1b82d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/app/api/auth/[...nextauth]/route.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ const authOptions = {
2525
return session;
2626
},
2727
async signIn({ user, account, profile, email, credentials }) {
28+
const lookup = await prisma.account.findUnique({
29+
where: {
30+
provider_providerAccountId: {
31+
provider: "github",
32+
providerAccountId: account.providerAccountId,
33+
},
34+
},
35+
});
36+
37+
if (!lookup) {
38+
return true;
39+
}
40+
2841
await prisma.account.update({
2942
where: {
3043
provider_providerAccountId: {

0 commit comments

Comments
 (0)