Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of cookie-parser with passport.js still needed?

Can not find any info (on passport.js site) about general passport.js instalation and declaration in node.js. In the tutorials I always see express session middleware and cookie-parser stated as required for passport, yet session docs (https://github.com/expressjs/session) notes:

'Since version 1.5.0, the cookie-parser middleware no longer needs to be used for this module to work. This module now directly reads and writes cookies on req/res. Using cookie-parser may result in issues if the secret is not the same between this module and cookie-parser.'

So do I need to use session & cookie-parser for passport for some reasons, or I can use only session, am I need to tweak something then?

like image 478
Max Yari Avatar asked Mar 18 '15 12:03

Max Yari


1 Answers

No, passport itself does not require cookie-parser middleware. If you want session-persistent authentication then you'll need the express-session middleware, which used to require cookie-parser, but modern versions of express no longer have this requirement (the current version of express-session reads and writes cookies directly).

like image 70
Wrecks Avatar answered Oct 09 '22 11:10

Wrecks