-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting bcypt authentication error #11
Comments
I had the same issue and was able to fix it by removing the beforeCreate and beforeUpdate hooks in the User.js model. For me it was hashing the plain text password and then hashing the hash so the compare function would never work. Apparently beforeSave is the same as calling both beforeCreate and beforeUpdate so calling the hashPassword function on beforeSave and beforeCreate caused this issue. Please let me know if this fixed your issue or if you need more detail. |
Thank u soooo much ,ihunter. |
@ihunter , I'm still having the same issue despite removing the beforeCreate and beforeUpdate hooks. |
I have been trying to figure this out for what feels like days. @ihunter That worked ..... AWESOME ! |
@MarbilleJuntado Did you try running the 'seed' again to clear your db? |
@HoikanChan I got the same problem.
then send the login request again with identical params:
I don't know how to fix this tho. I don't know how it works, but if it creates a new User object when you do |
@MarbilleJuntado, i try to comment beforeCreate: hashPassword and beforeUpdate: hashPassword, but the return is still false, try to using this code, without comment:
Idk it will fix your problem, but hopefully it can help you. |
So the problem arrived from the beforeSave in my case. old: |
The compare-password function using bcrypt always return false.
I have no idea why it return false when comparing the correct password.
I tried use the bcrypt's compare-function to compare the plain password and the correct hash password directly ,but it return false.
I tried to clone the project and run it . But bcrypt's compare-function still return me false all the time.
Can you guys tell me how to do with it ?
The text was updated successfully, but these errors were encountered: