Saturday 15 April 2017

bcrypt compare always returning false at rest api authentication using nodejs and mongoose

Im trying to do a basic authentication using nodejs and mongoose. When i post at the authentication route, isMatch returns false for the user password. I can't even say this is the broken part of the code, can someone guide me out?

  userSchema.methods.comparePassword = function(passw, cb) {
    bcrypt.compare(passw, this.password, function(err, isMatch) {
      if (err) {
        return cb(err);
      }
      cb(null, isMatch);
    });
  };



via GreetingsFriend

No comments:

Post a Comment