req.cookies is showing null

Open
#128 0 comments 0 reactions 0 assignees View on GitHub

@D-393Patel is already working on this.

Since Nov 13, 2025.

  • #150 by @D-393Patel — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Domain
api, backend

Research direction

The report names an unnamed token-validation middleware and the app.js /test route; start by reproducing the login and validation request and compare the two req.cookies logs. Trace the request path between those entry points, then verify a concrete explanation for the empty object and confirm the expected accessToken value during validation.

Written by the indexing model from the issue text.

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);
});
Dominant language
JavaScript
Stars
2k
Forks
237
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/cookie-parser

All issues in expressjs/cookie-parser

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.