tokenverifycookie-httponly

How i verify token, that was stored in cookie httpOnly on browser?


i use express in back end and this is my token was stored in browser enter image description here

My question is "how i verify or get the value as "access_token" name was stored in cookie httpOnly to my expressjs app"?


Solution

  • Express has a package called cookie-parser on npm you can install it using npm install --save cookie-parser. Then initialize it like this

    const cookieParser = require("cookie-parser");
    
    const app = express();
    app.use(cookieParser());
    

    Which lets you access req.cookies in your route.