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:
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 exampleIn the client, when an user uses the
/login
post method, it executes:The server receives this in the
onAuth
function, like this:But, when I ingress the right information, it does not return me the callback function... It shows me:
This is the complete code.