Questions tagged [express-session]

Simple session middleware for Express

The express-session module is a simple session middleware for Express.

937 questions
6
votes
3 answers

NodeJS express session expire after page refresh

The session of my nodejs app is expiring every time I refresh the page, after login. It does work fine if I visit different pages but as soon as I refresh the page, the session ends. I've tried a couple of things but none of it seems to work. How…
6
votes
0 answers

Cant set cookie with Express Session/Passport and REACT

I cant understand how i can set cookie (connect sid) in REACT from my back-end. I have a Passport Local Strategy Here is my server.js app.use(cookieParser()); app.use(session({ resave: true, saveUninitialized: false, secret: 'bla bla bla', …
kikiwie
  • 280
  • 1
  • 2
  • 10
6
votes
1 answer

Socket IO using express session - socket.request.res undefined

I am currently trying to implement session management using express 4.x and socket io 1.4, referencing this answer. The problem is that the second argument to the express session function is the res (response) object which is returning 'undefined'…
naughty boy
  • 1,779
  • 2
  • 12
  • 26
6
votes
2 answers

Node.js, ws and express-session : how to get session object from ws.upgradeReq

I have an application built on express, express-session and ws ( for the websocket support). I have used this code to enable the session middleware: app.use(session({secret: 'mysecret',resave: true,saveUninitialized: true,cookie: {}})); And I can…
alexroat
  • 1,518
  • 3
  • 21
  • 32
5
votes
2 answers

express-session deprecated req.secret; provide secret option app.js:27:9

I typed npm start to run my program but this is the comment that U received in the terminal: express-session deprecated req.secret; provide secret option app.js:27:9. I don't understand how this issue needs to be fixed. This is the code from…
5
votes
1 answer

session-file-store Delete expired session files

I am using session-file-store to maintain the sessions in my Node-Express app. session-file-store generates a new file for every session. This will create lots of files on the server over time. Is there any option / way to automatically delete the…
Nis
  • 329
  • 2
  • 11
5
votes
2 answers

express session not saving for Ipad

I am trying to save a session variable for a user when they login. This works on the computer, but when I try it on an iPad using Safari or Chrome it doesn't save. Here is where I set up my session: app.set('trust proxy', 1) app.use(session({ …
BStill
  • 839
  • 1
  • 8
  • 29
5
votes
1 answer

How to use subscriptions-transport-ws with passport and express-session

I'm using a passport local strategy that works well with express: passport.use(localStrategy); passport.serializeUser((user, done) => done(null, JSON.stringify(user))); passport.deserializeUser((obj, done) => done(null,…
5
votes
2 answers

How to extend express session timeout

I'm using express js 4 together with express-session and set maxAge to one hour. However if user continues accessing the website, the timeout should be extended otherwise the user will be logged out even he/she is still using it. app.use(session({ …
Anurat Chapanond
  • 2,297
  • 1
  • 13
  • 21
5
votes
3 answers

Why passport-twitter requires session support

I'm working on facebook, google, github, twitter authentication with passport. Authentication with facebook, google, github are executing how in tutorial was written. Only twitter back me message: 500 Internal Server Error: OAuth authentication…
5
votes
1 answer

Updating of a custom req.session property value does not seem to persist quick enough

I have some Express middleware handling GET requests from my client side application to make subsequent requests to a separate API server that uses OAuth2 tokens, I am also using express-session for the storage of these tokens. In my middleware that…
mindparse
  • 7,083
  • 17
  • 64
  • 146
5
votes
0 answers

express-session: Rolling session expiry configuration

So I'm using express-session with a mongo store like so: app.use(session({ secret: 'some secret here', saveUninitialized: false, resave: false, store: new MongoStore({ url: 'http://someurlhere' }) })); I have some login middleware,…
mindparse
  • 7,083
  • 17
  • 64
  • 146
5
votes
3 answers

Node Express can't set session with post request

I use node express 4.0 to implement a message code verify function. I use session to store the msg code I send. I set up the session middleware as dos said: app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ …
Jack Zhang
  • 1,775
  • 3
  • 19
  • 31
5
votes
1 answer

How to generate custom session id with express-session?

I am using Redis as session store and I would also like to create custom session id with express-session. So far I achieved was creating session with constant string like this: redis configuration var express = require('express'); var path =…
surenyonjan
  • 1,989
  • 2
  • 15
  • 25
5
votes
2 answers

Is it possible to get an express session by sessionID?

I have a NodeJS Express app that uses express-session. This works great, as long as session cookies are supported. Unfortunately it also needs to work with a PhoneGap app that does not support cookies of any kind. I am wondering: Is it possible to…
user1031947
  • 5,172
  • 14
  • 48
  • 76
1 2
3
62 63