Unable to retrieve token from the headers, JWT token is not storing in cookie storage as I am unable to retrieve user info from local storage.
I am retrieving the user information from the jwt token, when I have encountered an unique error, When I have written code it is giving output as undefined also the cookie that was stored under the header seems to be incorrect. I am doing this because I want to retrieve the user email from the token. Besides this the data is not storing in cookie storage, if you asking question of why I am using cookie storage, it is because I am not getting solution of how can we get token from local storage . The codes and the token are mentioned below
`Code to store cookie in the cookie storage but it is not storing in cookie storage`
`res.status(200);
res.cookie("cookie",token,
{httpOnly:true
// secure:process.env.NOD_ENV==="production",
// maxAge:1000,
// signed:true,
}
)
Code to get token from header and the output is undefined
const autheader = req.headers.token;
console.log("Token value is ", autheader);
Don't know what is this
cookie=eyJh%---some more text ------% dRNc3d4Y7o; Path=/; HttpOnly`
Devendra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.