node.bcrypt.js
node.bcrypt.js copied to clipboard
[bug] bcrypt.compare always returns "true"
I am working on next.js project then encounter some bcryptjs library issue.
Snippet of package.json:
node: v20.11.1
"next": "15.1.7",
"next-auth": "^5.0.0-beta.25",
"bcryptjs": "^3.0.2",
Snippet code: the issue is no matter what I input is always return true of comparing:
console:
Hey, I'd supposed that the value sent to bcrypt.compareSync should be user.password instead of password? It seems you are comparing the input against itself.
Hey, I'd supposed that the value sent to
bcrypt.compareSyncshould beuser.passwordinstead ofpassword? It seems you are comparing the input against itself.
Oh my bad, I just realize the logic is not make sense. TYVM~ 🙌