Questions tagged [bcryptjs]

26 questions
2
votes
1 answer

Why is my Node.js app not correctly validating passwords at login (using passport-local and bcryptjs)?

I'm building a Node.js application and having trouble with login validation. I'm using the passport-local strategy with bcryptjs but whilst it's correctly identifying when the username does not exist in the database, it is logging in users even when…
Ollie
  • 25
  • 4
2
votes
1 answer

Cannot find module 'bcryptjs'

I installed @types/bcryptjs package in nodejs. When I import it only, there is no problem but when I use it in my code, like that: console.log(bcrypt.hashSync(req.body.password)) it gives me an error; Cannot find module 'bcryptjs' What do I do? I…
Aref
  • 23
  • 3
2
votes
1 answer

Multiple JWT's match hashed JWT

I'm using bcryptjs to hash a user's refresh_token before storing it in my database. It seems that the following always evaluates to true when comparing a hashed string with a JWT, I've also gotten the same behavior on…
JamesRichardson
  • 131
  • 2
  • 13
1
vote
1 answer

why hashedPassword = await bcrypt.hash(this.password, salt) is not working?

I'm basically trying to just hash a password using bcrypt using async/await but nothing is working... next() is not working and it is not saving the data into the database and even not hashing the password const bcrypt = require("bcryptjs") …
0
votes
1 answer

Using bcrypt on client side web page using JavaScript

For crypto-js, it was easy to use it like: Is there any similar option for bcrypt, so that I can add it to a static page?
Harsh
  • 363
  • 4
  • 14
0
votes
0 answers

Cannot use bcryptjs in boilerplate

I am trying to use 'bcryptjs' in my 'boilerPlate' project but I am getting this warning. I tried adding 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' to '.erb/configs/webpack.config.main.prod.ts', 'webpack.config.renderer .…
0
votes
0 answers

angular v15 pollyfills bcryptjs

i wanted to use bcryptjs on angualr15. it didnt work. it throws error referring to polyfills. I made a reproducation example: when going for ng reproduction project --skip-git then in the cli go for: npm i bcryptjs or npm i argon2 for simplicity…
Mathanuel
  • 1
  • 3
0
votes
2 answers

bcryptjs doesn't encrypt password before storing in mongodb and save a plain text

I am using bcryptjs to hash passwords before storing inside mongodb but it store passwords as plaintext(no hashing).this is my userModel.js const mongoose = require("mongoose"); const bcrypt = require("bcryptjs"); const userSchema = new…
Aliking66
  • 31
  • 7
0
votes
2 answers

Node.js, mongodb, bcrypt.js login system not checking user's passwords correctly

I'm trying to create a basic login system using Node.js, mongodb and bcrypt.js. The registration is working as expected, however the user login is not, since it only works correctly for the first user in the database, only allowing any other user to…
0
votes
1 answer

encrypt/decrypt password using bcryptjs in node

I am trying to encrypt my password field i a registration form I created using bcryptjs but it isn't working In mongodb, on post the data from the form, the password field shows the password entered in the form instead of encrypting it const…
0
votes
0 answers

Bcrypt.js request has no response data available on chrome

I seen created some login credentials that response on chrome console. before installation of bcryptjs that displays "bcryptjs request has no response data available" on chrome. give some solution and how can I solve this. I seen created some login…
0
votes
0 answers

return from bcrypt.compare

I am currently making an authentication server, but no matter what I do, I can not get this function to return something. I would like this function to return ok if the hashed password compares to the userpassword and return invalid password or User…
derakoib
  • 23
  • 6
0
votes
0 answers

Express is throwing an ERR_HTTP_HEADERS_SENT error when a .catch is chained to the end of a bcryptjs.hash function call

My Express app has the following endpoint: app.post('/test', myFunc) with the following endpoint handler function: const bcryptjs = require('bcryptjs') function myFunc(req, res) { let password = 'password1234' let saltRounds = 10 …
JCollier
  • 1,102
  • 2
  • 19
  • 31
0
votes
1 answer

How do I go about making the change password route in my restAPI?

I am currently doing this to register users: const register = async (req, res) => { const seller = await Seller.create({ ...req.body }); res.status(StatusCodes.CREATED).json({ seller }); }; I am using the pre-save function to hash the…
Vromahya
  • 51
  • 6
0
votes
1 answer

Brcyptjs (javascript package) does not work for long values

I am using bcryptjs to hash passwords and some other data (All strings), the problem is, when the value of my hashed variable goes over a certain length, bcryptjs compares only the first 71 characters. Bcrypt in code represents bcrpytjs…
Caliph Hamid
  • 335
  • 1
  • 10
1
2