Bad Request when logging in with Passport, Express and Nodejs

Asked

Viewed 117 times

1

I am trying to authenticate a system but whenever I try to login (post) I get an error:

400 (bad request).

On the console appears the message:

The Character encoding of the Plain text Document was not declared. The Document will render with garbled text in some browser Configurations if the Document contains characters from Outside the US-ASCII range. The Character encoding of the file needs to be declared in the transfer Protocol or file needs to use a byte order mark as an encoding Signature.

This is my route that receives the login POST

router.post('/',
  passport.authenticate('local'),
  function(req, res) {
    res.json({ currentUser: req.user });
    //console.log(req.body);
    //res.redirect('/');
  }
);
  • I am experiencing the same difficulty. Using the MDB Atlas. If you have the answer, please tell me?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.