Update session-based-authentication.md (#4844)

fix/markdown
Drew Rodrigues 12 months ago committed by GitHub
parent 9c9c59911b
commit 243778cf11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/data/guides/session-based-authentication.md

@ -96,7 +96,7 @@ app.listen(3000, () => {
});
```
The important piece to note here is the `express-session` middleware registration which automatically handles the session initialization, cooking parsing and session data retrieval, and so on. In our example here, we are passing the following configuration options:
The important piece to note here is the `express-session` middleware registration which automatically handles the session initialization, cookie parsing and session data retrieval, and so on. In our example here, we are passing the following configuration options:
- `secret`: This is used to sign the session ID cookie. Using a secret that cannot be guessed will reduce the ability to hijack a session.
- `cookie`: Object containing the configuration for session id cookie.
@ -176,7 +176,7 @@ Next, we have to implement the functionality to process the login form submissio
```javascript
module.exports = function processLogin(req, res) {
if (req.body.username !== 'admin' || req.body.password !== 'admin') {
return res.send('Invalid username or password);
return res.send('Invalid username or password');
}
req.session.userid = req.body.username;

Loading…
Cancel
Save