Questions tagged [express-session]

Simple session middleware for Express

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

1209 questions
5
votes
1 answer

express-session req.session.touch not a function?

I'm working on a personal project, recently included express-session and cookie-session. Though i'm having a problem when navigating to localhost:3000/, i get an error telling me that req.session.touch is not a function in express-session module.…
Danielcraig
  • 121
  • 11
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
  • 449
  • 4
  • 13
5
votes
3 answers

How to implement CSRF protection in Nextjs with Apollo and GraphQL

Following this example in Nextjs repository, I want to implement the CSRF protection (perhaps with csurf package), because I'm using a session ID cookie with express-session. I tried setting csurf in my custom server and save the generated token in…
The_Wolf
  • 175
  • 1
  • 4
  • 14
5
votes
3 answers

Error: secret option required for sessions (espress session)

I always get the same error when I try to run my site on localhost with apache and self-signed ssl certificate. I have no idea why this error appears. This is my session persistence, I don't know if there is a misstake, but I can't imagine....…
Daniel Dalan
  • 101
  • 1
  • 2
  • 11
5
votes
2 answers

how to manage multiple session in express js

i am building a site that as two url ('/','/admin') session are conflicting here is my app.js session code app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); …
Emibrown
  • 167
  • 2
  • 12
5
votes
1 answer

Retrieving connection pool from Knex (to share it with express-mysql-session)

I've got knex configured to use MySQL with pooling: var knex = require("knex")({ client: "mysql", connection: { host: ..., user: ..., password: ..., database: ... }, pool: { min: 0, …
Jason C
  • 38,729
  • 14
  • 126
  • 182
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
  • 6,115
  • 27
  • 90
  • 191
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
  • 6,115
  • 27
  • 90
  • 191
4
votes
0 answers

express-session not working in safari and IOS

I am working on an express server, that used as an API for 3 web apps (admin, clients, and miniAdmin). The project is in staging for testing before production, but the problem is that the cookies not saving on safari on macs, and all the browsers on…
Yossi Shemesh
  • 79
  • 1
  • 5
4
votes
1 answer

TypeError [ERR_INVALID_ARG_TYPE], express-session+redis Error

I am developing with typescript + express i want use Redis to Session Storage and i installed redis, connect-redis and i code below import { createClient } from 'redis'; import * as RedisStore from 'connect-redis'; ... const client = createClient({ …
Jo In Hyeok
  • 141
  • 1
  • 7
4
votes
1 answer

How do I add a mock session for express-session when using SuperTest?

I have the following session setup... setupSession(){ const session = { secret: process.env.SESSION_SECRET, cookie: {}, resave: false, saveUninitialized: false, }; this.app.use(expressSession(session)); } I have the following…
Jackie
  • 21,969
  • 32
  • 147
  • 289
4
votes
1 answer

Socket.IO and Express session not sharing their session

I am trying to connect the sessions of express API and socket.IO server. But it seems both are storing their sessions separately. The socket.IO have the connections session while the express server has the user qid session. I am using express…
plutolaser
  • 448
  • 4
  • 17
4
votes
1 answer

Express Session: Property 'signin' does not exist on type 'Session & Partial'. (2339)

I got following Error Code: Property 'signin' does not exist on type 'Session & Partial'. (2339) My App src/index.ts import "reflect-metadata"; import express = require("express"); import { Request, Response, NextFunction } from…
swiftUser
  • 341
  • 6
  • 14
4
votes
2 answers

How to stop Stripe from over-writing client's session cookie after a successful purchase

Environment: Express, express-session, Stripe In the following simplified example when a user requests the home page express-session assigns the user a session cookie. Refreshing the page retains the same session id as does visiting the success or…
4
votes
2 answers

Setting sameSite="none" and secure="true" not fixing new CORS error thrown by Chrome

I've been trying to fix the new CORS issue thrown by Google Chrome via express-session but it doesn't seem to fix it. Specifically, this error: A cookie associated with a cross-site resource at http://plant-app-test.herokuapp.com/ was set without…