Questions tagged [express-session]

Simple session middleware for Express

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

1209 questions
3
votes
1 answer

Express Session and Amazon Beanstalk with health check

I have a problem with express session, connect-mongo and Amazon Beanstalk. Each time that Amazon Beanstalk wants to check health, It's doing a request to API but it creates a new document in mongodb database. So, in a short time Amazon creates…
saeta
  • 4,048
  • 2
  • 31
  • 48
3
votes
1 answer

How to find sessions stored in Mongo via MongoStore?

I'm using express-session along with passport and MongoStore to store my sessions. They're obviously being stored in the MongoDB, how can I access them just to take a look at? There's no business value in this it's just from a theoretical/technical…
Anthony
  • 13,434
  • 14
  • 60
  • 80
3
votes
0 answers

express session creating new session with api call

I am having an issue accessing a saved req.session object. It seems that it is accessing a new req.session with a new api call. This is my server.js const logger = require('morgan'); const express = require('express'); const bodyParser =…
Diana F.
  • 31
  • 3
3
votes
0 answers

Invalidate all user sessions using express-sessions and knex

I have inherited a Express site which needs some updating. There is a route for resetting password, but I need to invalidate all the users sessions when this happen and allow for auto login on the current browser at the same time. I'm kinda new to…
MsJorge
  • 155
  • 2
  • 11
3
votes
1 answer

Why is my session expiring every time I close the browser?

I set up the session maxAge of express like documented. Here is my code: app.use(session({ secret: process.env.SESSION_SECRET, saveUninitialized: true, resave: true, maxAge: 1000* 60 * 60 *24 * 365, store: new…
Michael Seltenreich
  • 3,013
  • 2
  • 29
  • 55
3
votes
2 answers

Node/Express with connect-redis, how handle session expiry

I have a Node/Express application that use redis as session store. I have a question concerning the handling of the expiry of the session. I'd like have an active session until the browser is closed, so I didn't set a session expiration time. Doing…
Zauker
  • 2,344
  • 3
  • 27
  • 36
3
votes
0 answers

Generate test session manually with express-session

I have implemented the OAUth 2.0 flow as single authentication method for my express application. In real situation, once a user connected using OAuth, a session is created and accessible server-side in req.session.passport. In this session, there…
Overdrivr
  • 6,296
  • 5
  • 44
  • 70
3
votes
1 answer

Node Express Session is not working. Getting req.session.user undefined for next request

app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use(express_session({ secret: 'abcdefg', proxy: true, resave: true, saveUninitialized: true, })); app.post("/login", function(req, res, next)…
3
votes
1 answer

CSURF not working if the Session cookie is secure

I am stumped as to when I set the cookie to secure, the csrf of node is not working. //Load Cooike Parser app.use(cookieParser(secret)); //Load Session Store app.use(require('express-session')({ secret:secret, cookie:{ maxAge: 1000 *…
Mr A
  • 1,345
  • 4
  • 22
  • 51
3
votes
2 answers

express-session isn't setting session cookie while using with socket.io

I'm trying to implement authentication and sessions with socket.io. After a lot of research 1, I've set up the following which makes use of express and express-session. The issue is that, express and socket.io connections seems to be having…
T J
  • 42,762
  • 13
  • 83
  • 138
3
votes
1 answer

How to implement server side sessions in node.js with express for an android app?

Hello all i am making an android app in whiich i have multiple account login at a time now my question is that i for multiple logins i should use sessions to verify every account user that is logged in. Now i am using express on the server side i…
aman verma
  • 732
  • 1
  • 8
  • 26
3
votes
2 answers

Is express-session not working with express 4.13?

So I've set the session according to the documentation for express-session, as far as I can tell. But my cookie is not getting created! According to the documentation, all you have to do is set the request.session value and the cookie should…
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
3
votes
1 answer

Can't store variables in express session

I am trying to build a session-based authentication for my web app. I have the following auth function: function authenticate(req, res) { var body = req.body; getAuthUser(body.username, function (err, result) { if (hash(body.password) !=…
2
votes
0 answers

How do I check user sign-in status using the express-session?

I'm building an authentication app using the PEAN stack (i.e., PostgreSQL - ExpressJS - Angular - NodeJS). For authentication, I'm using express-session on the backend. Authentication on backend works 100% correctly. Problem I have a problem…
Rok Benko
  • 14,265
  • 2
  • 24
  • 49
2
votes
2 answers

information not persisted in session between two endpoint calls in Jest

im using express-session to store signin info in the most simple of ways: req.session.userId = user.id i use this configuration for both dev environment in which everything works perfectly, and specs: app.use(express.json()) app.use(sessions({ …
Leo
  • 2,061
  • 4
  • 30
  • 58