I am following the official documentation and also some online tutorial on how to configure email provider with next-auth, this is my config file:
export default NextAuth({
adapter: MongoDBAdapter(clientPromise),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_PROVIDER_CLIENT_ID,
clientSecret: process.env.GOOGLE_PROVIDER_CLIENT_SECRET
}),
LinkedInProvider({
clientId: process.env.LINKEDIN_PROVIDER_CLIENT_ID,
clientSecret: process.env.LINKEDIN_PROVIDER_CLIENT_SECRET
}),
EmailProvider({
server: {
host: process.env.EMAIL_SERVER_HOST,
port: process.env.EMAIL_SERVER_PORT,
auth: {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD
}
},
from: process.env.EMAIL_FROM,
maxAge: 60 * 60 * 24 * 30
})
],
secret: process.env.NEXTAUTH_JWT_SECRET,
theme: {
colorScheme: "light"
},
pages: {
signIn: "/signin",
signOut: "/",
newUser: "/"
},
callbacks: {
async session({ session, token, user }) {
session.user = {
id: user.id,
email: user.email,
isAdmin: user.isAdmin,
image: user.image
};
return session;
}
}
});
when I go to /signin I can see a page with 3 buttons: Google, linkedIn and Sign in with email. Google and LinkedIn work as expected. When I click on the 3rd one, I get redirected to
/signin?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fsignin&error=EmailSignin
The examples I've seen so far shows I should use async jwt() in the callback, however this configuration has been working for months with the other 2 providers so I don't want to change it for the 3rd one, unless really necessary.
In place ot the 3rd button, I'd expect to see a form where to enter an email address.
Any idea how can I debug this?