Node bcrypt's compare always returns false

you can skip doing bcrypt.genSalt and use bcrypt.hash(password, 10, function(err, hash) {..});

your compare function seems good to me.

this is working fine for me:

var bcrypt = require('bcrypt');

bcrypt.hash('mypassword', 10, function(err, hash) {
    if (err) { throw (err); }

    bcrypt.compare('mypassword', hash, function(err, result) {
        if (err) { throw (err); }
        console.log(result);
    });
});

I dont know if you have the same as I did, I had the same problem because my table had the length of 45 chars and I bcrypt compares if the hash lenght is diferent from 60 it returns false. Just increase the length of characters in your table


Mine was due to my database column not having a large enough varchar length. A good place to check.