# Hash Passwords with bcrypt

**URL:** <https://forum.freecodecamp.org/t/hash-passwords-with-bcrypt/414135>\
**Category:** freeCodeCamp Contributors\
**Tags:** contributing\
**Created:** [August 7, 2020, 9:12pm UTC](https://forum.freecodecamp.org/t/hash-passwords-with-bcrypt/414135 "2020-08-07T21:12:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mackenzieweaver](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mackenzieweaver](https://forum.freecodecamp.org/u/mackenzieweaver)\
**Post date:** [August 7, 2020, 9:12pm UTC](https://forum.freecodecamp.org/t/hash-passwords-with-bcrypt/414135/1 "2020-08-07T21:12:04Z")

</div>

**What is your hint or solution suggestion?**  
Change:

`password: req.body.password`

To:

`password: bcrypt.hashSync(req.body.password, 12)`

And in your local strategy change:

`if(password !== user.password)`

To:

`if(!bcrypt.compareSync(password, user.password))`

**Challenge:** Hashing Your Passwords

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/hashing-your-passwords)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:32pm UTC](https://forum.freecodecamp.org/t/hash-passwords-with-bcrypt/414135/2 "2021-06-01T18:32:31Z")

</div>

Closed on June 1, 2021, 6:32pm UTC


