Not able to authentiate by passport.js

not able to authenticate by passport.js plz help local strategy, serialize and deserialize everything is written

Upload your repo on github and send the link. I will see if something is wrong with your code.

https://github.com/Karansehgal15/project_discussForum

in signup route i want that after user gets created by post request it will get redirected to homepage

The passport.authenticate object you have used in /signup/new router is actually a middleware. Thus it has to be placed besides route.post(’…’, function(req, res, next) { … }, passsport.authenticate{…}) and where you have created the passport middleware, replace it with next()

updated my code and pushed changes to git

but now local strategy is failing

it is always get redirected to signup page

look for password matching condition in passporthandler file it is always gets evaluated to true and then strategy directs to signup page which is for failure case

In passporthandler.js you are compaing user.password !== passhash
I think there is some problem. Try console.log user.passport and passhash before comparing them, I think passhash is a promise object, while user.password is a string