Closed NomadXD closed 3 years ago
Face the same issue.. i checked and their local strategy middleawre not even invoke.
Have you tried creating the user first? /api/users/signup It looks for the user in the DB. Worked for me after creating user.
Hello Guys, As @muracevic suggests, users should be created first. Let me know if the problem persists. Thank you!
Feel free to join the AppSeed community on Discord to talk interactively.
I have the same issue. I have created the user and can see the user in the DB, I have also noticed that the password is not hashed, but stored plaintext. When hitting the API endpoint api/users/login with a JSON object in the body with the email and password I get
{ "message": "Missing credentials" }
I worked out the issue.
The login function requires that the body JSON object be formatted as this:
{ "user": { "email": "user@email.com", "password": "password123" } }
Passing the body as:
{ "email": "user@email.com", "password": "password123" }
Will cause this error.
You can fix this by amending /config/passport.js and change lines 16 and 17 from this:
usernameField: 'user[email]', passwordField: 'user[password]',
To this:
usernameField: 'email', passwordField: 'password',
There is still the issue that the password is not being hashed in the database though. I would not be comfortable using this in a production evironment until that issue is resolved.
Hello guys, Really sorry for this huge delay. This product enters into active support & versioning.
This issue is patched in v0.0.2 - As mentioned in the README file, the registration & login flow can be tested via curl
:
Create user
$ curl -X POST -H 'Content-Type: application/json' \
-d '{"username":"test1","password":"pass", "email":"test1@whatever.us"}' \
http://localhost:3000/api/users/signup
Login user
$ curl -X POST -H 'Content-Type: application/json' \
-d '{"email":"test1@whatever.us", "password":"pass"}' \
http://localhost:3000/api/users/login
`router.post('/login', auth.optional, (req, res, next) => { const { body: { user } } = req; console.log(req.body); const result = Joi.validate(user, userSchema);
});`
passport.authenticate always says missing credentials. From the call back err is set to null, user is set to false and info is set to missing credentials. I searched stackoverflow and google but could not find a solution. It always returns missing credentials.