node.js - "secret" option required for "app.use(express.cookieSession())" -


the website not specify requirement of 'secret' using app.use(express.cookiesession()); when using same in express calls 'secret option required. why?

even when provide secret app.use(express.cookiesession({secret: 'abc'})); following error shows in browser:-

typeerror: cannot read property 'connect.sess' of undefined

you can't use cookies without supplying crypting key , secret. can either pass secret in cookie parser, or can more elaborate , pass necessary values when setting session management. latter offers greater control , such best idea.

... app.use(express.compress()); app.use(express.bodyparser()); app.use(express.cookieparser()); app.use(express.cookiesession({   key: "mysite.sid.uid.whatever",   secret: process.env["session_secret"],   cookie: {     maxage: 2678400000 // 31 days   }, })); ... 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -