Session: express-session deprecated undefined resave option

Created on 10 Mar 2017  路  4Comments  路  Source: expressjs/session

i am a beginner for node js. Have used a code from the internet to authenticate a user from Twitter and Facebook but it is giving me the following error 馃憤
_`

express-session deprecated undefined resave option; provide resave option app.js :74:9 express-session deprecated undefined saveUninitialized option; provide saveUnini tialized option app.js:74:9 C:\Users\Win 8.1\Downloads\twitter-login-node-master\node_modules\mysql\lib\prot ocol\Parser.js:82 throw err; ^

code.docx

code is attached anyone who like to help

here is the link of the given site

https://codeforgeek.com/2014/09/twitter-login-using-node/

question

Most helpful comment

In your configuration to session, you need to specify the resave and the saveUninitialized options to the value you want to use. See https://github.com/expressjs/session#options for their values and meanings.

Example:

app.use(session({
    secret: cookie_secret,
    name: cookie_name,
    store: sessionStore, // connect-mongo session store
    proxy: true,
    resave: true,
    saveUninitialized: true
}));

Assuming you want to use true for those options.

All 4 comments

56

In your configuration to session, you need to specify the resave and the saveUninitialized options to the value you want to use. See https://github.com/expressjs/session#options for their values and meanings.

Example:

app.use(session({
    secret: cookie_secret,
    name: cookie_name,
    store: sessionStore, // connect-mongo session store
    proxy: true,
    resave: true,
    saveUninitialized: true
}));

Assuming you want to use true for those options.

@dougwilson sorry for my late to reply , i didn't found the above issue t first. And above issue has solved with your advise , but it creates another error saying that :

_express-session deprecated req.secret; provide secret option app.js:74:9
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:3306
    at Object.exports._errnoException (util.js:907:11)
    at exports._exceptionWithHostPort (util.js:930:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1077:14)
    --------------------_

THANKS IN ADVANCE

In your configuration to session, you need to specify the secret option to the value you want to use. See https://github.com/expressjs/session#options for their values and meanings.

Example:

app.use(session({
    secret: 'keyboard cat',
    name: cookie_name,
    store: sessionStore, // connect-mongo session store
    proxy: true,
    resave: true,
    saveUninitialized: true
}));

Assuming you want to use 'keyboard cat' as the secret.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alex55132 picture alex55132  路  22Comments

aheyer picture aheyer  路  15Comments

azfar picture azfar  路  14Comments

shaunwarman picture shaunwarman  路  17Comments

G-Adams picture G-Adams  路  16Comments