smtp-server
smtp-server copied to clipboard
Error: Authentication credentials invalid following `server.js` example.
I'm just trying to log in as a normal user, but I have this error: Error: Authentication credentials invalid
. I'm following the server.js example
In the client, when an user uses the /login
post method, it executes:
connection.connect(() => {
connection.login(
{
credentials: {
user: "[email protected]",
pass: "supersecretpassword"
}
},
err => {
console.error(err);
}
);
});
The server receives this in the onAuth
function, like this:
const isEmail = USERS.some(user => user.email === auth.username);
const isPassword =
auth.method === "CRAM-MD5"
? auth.validatePassword(password)
: USERS.some(user => user.password === auth.password);
// If the email and the password exists in the array `USERS`, return the information
if (isEmail && isPassword) {
return callback(null, { user: auth.email });
}
// If not, show me this error
return callback(new Error("Authentication failed"));
But, when I ingress the right information, it does not return me the callback function... It shows me:
This is the complete code.