Skip to content

req.cookies is showing null #128

Description

@pargaimanish

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);
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions