export const authOptions: NextAuthOptions = {
session: {
strategy: "jwt",
},
providers: [
CredentialsProvider({
type: "credentials",
credentials: {},
async authorize(credentials, req) {
const { email, password } = credentials as {
email: string;
password: string;
};
// perform you login logic
// find out user from db
const user = await prisma.user.findFirst({
where: {
email: email,
password: password,
},
});
if (!user) {
throw new Error("bad user");
}
return user;
},
}),
],
};
export default NextAuth(authOptions);
export const authOptions: NextAuthOptions = {
session: {
strategy: "jwt",
},
providers: [
CredentialsProvider({
type: "credentials",
credentials: {},
async authorize(credentials, req) {
const { email, password } = credentials as {
email: string;
password: string;
};
// perform you login logic
// find out user from db
const user = await prisma.user.findFirst({
where: {
email: email,
password: password,
},
});
if (!user) {
throw new Error("bad user");
}
return user;
},
}),
],
};
export default NextAuth(authOptions);