Questions tagged [express-session]

Simple session middleware for Express

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

1209 questions
4
votes
1 answer

Providing sessions when testing middleware in Express

I am attempting to test middleware functions in my Express application using supertest and nock, but am having issues where the routes I have setup are checked by an earlier piece of middleware to ensure a session property exists on the incoming req…
mindparse
  • 6,115
  • 27
  • 90
  • 191
4
votes
1 answer

When is a cookie created when using express-sessions?

I'm using express-sessions in a project and I'm struggling to understand when it creates a cookie on the browser to use with the session storage. In my project when I request my home page ("/") a cookie isn't created, however when I request any…
2K01B5
  • 1,011
  • 1
  • 10
  • 23
4
votes
1 answer

Ephemeral & MaxAge for express-session

I am trying to use the express-session package for session management in an express-js application. I have the following requirements: Cookie is destroyed client-side when browser is closed. Cookie is destroyed after 15 minutes idle time. Cookie is…
jzacharuk
  • 2,058
  • 1
  • 16
  • 22
4
votes
4 answers

How do I close separate sessions using node.js express-session?

I am using express-session module for session handling in my express.js app My express.js application creates session for user and admin privileges. I have req.session.user & req.session.admin The problem I have is I don't know how to close 1…
Wee Wee
  • 197
  • 1
  • 4
  • 12
4
votes
1 answer

using csurf with session in express

I'm writing a single page application with MEAN stack, and using express-session with redis for session management. I want to use scrf token in my client's cookies. the problem is when I add csurf middleware, it set a session with name csrfSecret in…
Elyas74
  • 548
  • 1
  • 5
  • 18
4
votes
0 answers

Passport session cookies in redis constantly keep getting created

My express app uses PassportJS for storing auth session but it creates a ridiculous number of keys in the redis store and all the keys look the…
mithun_daa
  • 4,334
  • 5
  • 38
  • 50
4
votes
1 answer

Renewing Cookie-session for express.js

I'm using the cookie-session module for Expresss.js to deal with sessions. I would like the sessions to be renewed on every page load (or ajax call). That's how they usually work anywhere. The documentation doesn't say a word about it. I've tried…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
4
votes
1 answer

Redis client connects to the redis remote server but can't read or write on it

In DegitalOcean, i have to manage two servers 'Nodeserver' and a redis server 'Redisserver' by making the connection possible from a node/express application on the former for using the latter's database. For the purpose of local tests, i've also…
Bardelman
  • 2,176
  • 7
  • 43
  • 70
4
votes
1 answer

How to retrieve SessionID in NodeJS with multiple servers?

I'm new to NodeJS. I am developing a REST API and using express-session to deal with sessions. So, to get the session ID I'm using var sessionID = req.sessionID This sessionID is generated from the server side. So, when I scale up to two or more…
4
votes
1 answer

Node js creating different session id for each request

Using express-session and storing session in files. However every request it is creating new session id and new file is getting created. Here is the code which i am using to create the session. app.use(session({ secret: 'keyboard cat', resave:…
Kishan Rajdev
  • 1,919
  • 3
  • 18
  • 24
4
votes
1 answer

Express-session defined in one route file not available in app.js Node JS

I have issue with express-session in node js and express 4. I set a session variable inside routes/index.js and is not available in app.js.But available on another route file users.js routes/index.js var…
Mohammed Safeer
  • 20,751
  • 8
  • 75
  • 78
3
votes
0 answers

axios withCredentials dont work in next.js

When I build MERN stack app I use axios withCredentials: true. And it work well. After I use this next.js but don't work In backend I use passport.js , passport-local-mongoose and express-session for authentication user. It don't work next.js app…
3
votes
1 answer

Cross site tracking on safari not allowing express session send cookies

So I built an app that uses passport and express session for its authentication. When I deployed, I discovered that safari was not letting express session work until I switched off 'cross site tracking' in its settings. How do I make this…
Kotai
  • 121
  • 1
  • 7
3
votes
1 answer

Express Sessions not reading session when running client on localhost

The problem I am facing is down to reading a role property of a session set by the users role in a database. Why is this behaviour happening? It makes it difficult to develop new features which rely on backend control of API…
wbbigdave
  • 71
  • 1
  • 9
3
votes
1 answer

Table '[database-name].sessions' doesn't exist - using express-session

Here is some sample code that outlines my issue. I'm trying to get express-session / connect-session-sequelize to work for a website with login functionalities. However, when I try to call my POST request, I get the following error: I can only…
easymoney
  • 85
  • 5