Open JonathanSum opened 6 years ago
Were you ever able to fix this?
Another one banging the head against the wall...
Good Question! @MauriceMorrey @Croma1994 I remember I fix it. But if you look at the date, do you still remember how to fix it if it is you? But don't worry! The solution must be in my GitHub repo because I usually upload almost everything I do. So the solution so far is to find the same piece of code in my Github, and you will see a fixed solution.
So far I don't want to spend too much time finding it on my repo, but if we have too many people have this issue, I may find it, test it, and debug it.
So far I don't want to spend too much time on Web things but in Deep Learning.
So far, in my case was just passing this into the local strategy because I had custom named fields...
{
usernameField: "name",
passwordField: "password",
passReqToCallback: true,
}
@Croma1994 does it work? If it works, it is great.
@JonathanSum Yep! I had a misconception, thought that the local strategy function searched automatically for the req.body payloads no matter what name attribute they had, but you have to pass that object specifying the name and passing the req to the callback in order to use flash messages.
Didn't work for me, i have been banging my head for 3 days? Any fix guys?
Yeah. Another one has the same issue. Welcome on board.
Also same issue Missing credentials
passport.use('local.signup', new LocalStrategy({ usernameField: 'email', passwordField: 'passwd', passReqToCallback: true }, function(req, username, password, done) { req.check('email', 'Invalid Email').notEmpty().isEmail(); req.check('password', 'Your password must be at least 5 characters').notEmpty().isLength({min:5}); var errors = validationErrors();
Which I followed from http://www.passportjs.org/docs/username-password/
I don't quite remember the fix but it had something to do with passing parameters named differently; in the documentation link @jefflaub12 shared, it says;
"By default, LocalStrategy expects to find credentials in parameters named username and password. If your site prefers to name these fields differently, options are available to change the defaults."
I know it says you have the option to change defaults but if I remember correctly, using the defaults fixed the issue for me.
Good luck.
That did it used the defaults instead of attempting to rename the variable for usernameField. Thanks
Is this part, which in the passport.js, wrong?
passport.js
user.js
app.js
One more thing, this database.js file is in the config folder what des the variable secret for? People say it can be anything. database.js