14

I'm facing a situation that need to verify password created via PHP password_hash method on nodejs server.

Does nodejs have an available package that equivalent to password_hash and password_verify? Thank you.

0

2 Answers 2

16

In my case i created password in php like below

$data['password'] = password_hash($data['password'],PASSWORD_BCRYPT);

In Node if i want to verify that password than ...

var bcrypt = require('bcrypt');
params.hash = params.hash.replace('$2y$', '$2a$');
bcrypt.compare(params.password, params.hash,async function(err, correct) {
 console.log(correct);
});

Hope it will help you .....

Sign up to request clarification or add additional context in comments.

Comments

4

No, you will have to make use of one of the many Bcrypt libraries for Node.js.

P.S.: You're basically duplicating another user's question (Verify password hash in nodejs which was generated in php).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.