Cannot find any examples of implementing this logic properly in NextAuth.
providers: [
GoogleProvider({
clientId: config.google.clientId,
clientSecret: config.google.clientSecret,
}),
CredentialsProvider({
name: "Credentials",
credentials: {
email: {
label: "Email",
type: "text",
placeholder: "[email protected]",
},
password: { label: "Password", type: "password" },
},
async authorize(credentials) {
if (!credentials) return null;
// sanitize credentials
credentials.email = credentials.email.trim().toLowerCase();
credentials.password = credentials.password.trim();
const userCredential = await signInWithEmailAndPassword(
auth,
credentials.email,
credentials.password
);
const user = userCredential.user;
if (!user) return null;
return {
id: user.uid,
email: user.email,
};
},
}),
// ...add more providers here
],
these are my providers, the google provider works perfectly, however I am having trouble setting up the email/password firebase method. Any ideas on what could be wrong here?