CredentialsProvider({
name: "Login",
credentials: {
email: { label: "email", type: "email", placeholder: "jsmith" },
password: { label: "Password", type: "password" },
},
async authorize(credentials, req) {
if (!credentials?.email || !credentials.password) return null;
const { data, error } = await supabase.auth.signInWithPassword({
email: credentials?.email,
password: credentials?.password,
});
if (error) throw Error(error.message);
if (!data.user) throw Error("No user found for this credentials");
return data.user;
},
}),
CredentialsProvider({
name: "Login",
credentials: {
email: { label: "email", type: "email", placeholder: "jsmith" },
password: { label: "Password", type: "password" },
},
async authorize(credentials, req) {
if (!credentials?.email || !credentials.password) return null;
const { data, error } = await supabase.auth.signInWithPassword({
email: credentials?.email,
password: credentials?.password,
});
if (error) throw Error(error.message);
if (!data.user) throw Error("No user found for this credentials");
return data.user;
},
}),