expressjs / expressjs/cookie-parser

req.cookies is showing null

Open
#128 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

working on node.js project where creating login and using cookies to store user. but for user validation to get current user. the token validation middleware is giving `[Object: null prototype] {}`

middle ware:
```
const vailedToken = asyncHandler(async(req, res, next)=>{
const token = req.cookies.accessToken;

console.log(token);
---stuff----
} );

});

module.exports = vailedToken;
```

and when i am testing as get route in app.js. the its showing the req.cookies with accessToken

```
app.get("/test", (req, res) => {
console.log("Cookies:", req.cookies);
res.json(req.cookies);
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.