Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login and sign up don't parse in module 3 #33

Open
rshom opened this issue Nov 15, 2016 · 6 comments
Open

login and sign up don't parse in module 3 #33

rshom opened this issue Nov 15, 2016 · 6 comments

Comments

@rshom
Copy link

rshom commented Nov 15, 2016

Due to an update in express, the login and signup won't parse properly. You have to use req.body.username instead of req.username. This also requires body-parser from npm.

Check out: http://expressjs.com/en/4x/api.html#req.body

@adaymuhajier
Copy link

Weird, it works fine with signup and signout, but got a 500: Internal Server Error if I try logging in.

@0xezgh
Copy link

0xezgh commented Dec 8, 2016

Are you typing correct credentials ? @adaymuhajier

@adaymuhajier
Copy link

nvm, got it working. just a minor typo @Ezdin

@harishsainik
Copy link

While making post request to http://localhost:3000/auth/signup with username and password, I am getting redirected to /auth/failure and can't sign up. It may be because of an update. Can anybody tell me what changes should I make and in which files.

@JeremyJamesG
Copy link

@rshom mate, in what section would you put req.body.username??

@akun1
Copy link

akun1 commented Sep 11, 2018

@JeremyJamesG you would put it in your authenticate.js file. Specifically in your success and failure routes. Also, I had to change req.user to req.user.username to return a username. Otherwise, it was always null or undefined. Here's what it looked like after the changes

//sends successful login state back to angular router.get('/success', function(req, res){ res.send({state: 'success', user: req.user.username ? req.user.username : null}); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants