In Express.js, req.signedCookies is an object of signed cookies that cookie-parser has verified with your secret. Values are unsigned and ready to use. If none are present, it defaults to {}.
Two Set-Cookie calls. One unsigned, one with signed: true.
Parser splits them. Valid signed cookies are moved into req.signedCookies.
Plain stays in req.cookies.theme is easy to forge — do not treat it as proof of identity.
Intent is clear. Reading from signedCookies signals “this value was verified.”
Example 3 — Detect a Tampered Signed Cookie
Failed signatures become false — reject them explicitly.
Express
const express = require('express');
const cookieParser = require('cookie-parser');
const app = express();
app.use(cookieParser('demo-secret'));
app.get('/account', (req, res) => {
const user = req.signedCookies.user;
if (user === false) {
res.clearCookie('user');
return res.status(400).send('Tampered signed cookie');
}
if (!user) {
return res.status(401).send('Missing signed cookie');
}
res.send('Account for ' + user);
});
app.listen(3000);
Output
Valid cookie
→ 200 Account for tobi
Tampered Cookie: user=s:hacker.<bad-sig>
→ req.signedCookies.user === false
→ 400 Tampered signed cookie
No cookie
→ 401 Missing signed cookie
How It Works
Parser verifies. Bad signatures do not yield the forged string — they yield false.
Check false first. Distinguishes “tampered” from “missing” (undefined).
Clear bad cookies.res.clearCookie drops the bad value from the client.
Only trust real values. Proceed when you have a non-empty, non-false string.
Compatibility
Runtime Support
req.signedCookies is populated by the cookie-parser middleware on an Express.js server (Express 5 needs Node.js 18+). Browsers only store and send the Cookie header.
✓ Server · Express 4 & 5
req.signedCookies
Works wherever Express and cookie-parser run: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not a browser API.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
req.signedCookiesExpress + cookie-parser
Bottom line: Install cookie-parser, pass a secret, and run examples with Node.js and the express package.
Frequently Asked Questions
It is an object of signed cookies that cookie-parser has verified with your secret. Values are unsigned and ready to use. It defaults to {} when none are present.
Yes. Mount cookie-parser with a secret, for example app.use(cookieParser('my-secret')). Without a secret, signed cookies are not parsed into this object.
req.cookies holds unsigned (plain) cookies. Valid signed cookies are moved into req.signedCookies so you do not confuse easy-to-spoof values with verified ones.
Signature validation fails. cookie-parser sets that cookie’s value to false in req.signedCookies instead of the tampered string.
No. Express documents that signing prevents tampering; it does not hide or encrypt the value. Anyone can still read the cookie contents.