I am failing this one and only test case:
Async hash generated and correctly compared
And the error log says
Nested within the hash function should be the compare function comparing myPlaintextPassword to hash
Here is my code. Can I get some help please?
bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => {
console.log(hash);
bcrypt.compare(someOtherPlaintextPassword, hash, (err, res) => {
console.log(res);
});
});
Figured it out. I had to compare myPlaintextPassword with itself not something different.
I’m hitting a similar error on this lesson, but from what I can tell my code is correct. I hit an odd bug on an earlier lesson in this module, so I’m wondering if that’s the case again. Here is my code:
bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => {
console.log(hash);
//END_ASYNC
//START_SYNC
bcrypt.compare(myPlaintextPassword, hash, (err, res) => {
console.log(res);
});
});
And here is a link to my project:
Combining automated deployment, instant hosting & collaborative editing, Glitch gets you straight to coding so you can build full-stack web apps, fast
Any ideas on what might be causing my issue?
Never mind, I found the issue for mine as well.
All of the code from that lesson should be contained within the //START_ASYNC and //END_ASYNC comments.
//START_SYNC and //END_SYNC block is entirely for the next lesson.
3 Likes