saving user to the dabase when using the debug credentials provider

This commit is contained in:
Yannic Kilcher
2022-12-31 17:32:02 +01:00
parent 528d8d4cf9
commit 4a4cf3c3a6
+10 -1
View File
@@ -43,10 +43,19 @@ if (boolean(process.env.DEBUG_LOGIN) || process.env.NODE_ENV === "development")
username: { label: "Username", type: "text" },
},
async authorize(credentials) {
return {
const user = {
id: credentials.username,
name: credentials.username,
};
// save the user to the database
await prisma.user.upsert({
where: {
id: user.id,
},
update: {},
create: user,
});
return user;
},
})
);