You only need to install it using one or the other. Although, you can go to each one to give them a different secret to use.
The difference between them lies in their so-called "greed" with her.
session(secret) keep secret by itself, only using it for a cookie containing the session identifier.
cookieParser(secret) , on the other hand, will allow you to sign any cookie.
You can create signed cookies with Express' response.cookie() .
Signed cookies are also supported using this method. Just pass the signed option. When given res.cookie() will use the secret passed in express.cookieParser(secret) to sign the value.
res.cookie('name', 'tobi', { signed: true });
You can later access this value through the req.signedCookies object.
source share