Questions tagged [express-session]

Simple session middleware for Express

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

937 questions
9
votes
3 answers

Namespace 'Express' has no exported member 'SessionData'

I'm trying to build a typeScript project but it has an error and I do not know where it comes from and nothing has changed since last time. node_modules/connect-mongo/src/types.d.ts:113:66 - error TS2694: Namespace 'Express' has no exported member…
Reza Razani
  • 93
  • 1
  • 7
9
votes
1 answer

Proper configuration for Node session storage with Redis Cloud and Heroku

It is unclear what are the correct configuration parameters to use are in the situation of using Redis Cloud and Heroku, and can't find a functioning example online. Here is my current code: const express = require('express') const session =…
9
votes
3 answers

NodeJS: "ENOENT" warning messages with sessions

I'm using node with the express-session and session-file-store packages. The session data is stored as files in the root directory, using the session-file-store package. However, now my logs are being clogged because the message…
terpak
  • 1,033
  • 1
  • 14
  • 29
8
votes
4 answers

using apollo, cookie in response header but not being set

I'm developing a user login/register feature as part of a larger project and am working on localhost (apollo server and react apollo front-end). I'm using express-session for my sessions. When submitting my login I can see the response header has…
Michael Ross
  • 79
  • 1
  • 3
8
votes
1 answer

GraphQl and passport session: access req.user when querying GraphQl

I have a GraphQl server and a react frontend. I use passport and LocalStrategy to authenticate the user which works well, I can successfully login an existing user. I also want to use passport session to create a user session, so that I can access…
8
votes
7 answers

Express-session Secure Cookies not working

When not using secure cookie true setting, my app user login works fine. When I enable secure cookies, the login appears to go through fine, but it seems the cookie is not saved and the user is not logged in. In other words, this works: app =…
Justin Lok
  • 927
  • 1
  • 13
  • 30
8
votes
2 answers

Session auto logout after inactivity

Is there a built in feature in express session, to enable auto logout after given time of inactivity ? I am using it as below, and want it to logout if session is inactive for half an hour. app.use(session({ key: 'sessid', secret: 'This is…
nishant pathak
  • 326
  • 1
  • 4
  • 12
7
votes
2 answers

How to track req.session variable with node-inspector to understand how a session object gets removed from request.session

//Initializing session app.use(session({ secret: 'keyboard cat', resave: true, saveUninitialized: true //cookie: { secure: true } })); I was creating a shopping cart and came across a problem , I was setting cart object in session…
codefreaK
  • 3,376
  • 4
  • 29
  • 56
7
votes
2 answers

Where is the express-session cookie hidden?

My express-session is working, I tested it with a very short cookie max-age (10 secs) and it works as intended: app.use(session({ secret: 'xxx', resave: false, saveUninitialized: true, cookie: { secure: true, maxAge: 10000 } })); The…
low_rents
  • 4,161
  • 2
  • 20
  • 47
7
votes
3 answers

How to use express-mysql-session in Typescript projects?

I'm trying to use express-session and express-mysql-session within a Typescript project. Here's the relevant part of my code: import * as express from "express"; import * as expressSession from "express-session"; import * as expressMySqlSession from…
Timo Kunze
  • 125
  • 6
7
votes
1 answer

express-session secure: true

app.use(session({ secret: "testing credentials", store: sessionStore, resave: true, saveUninitialized: true, cookie : { httpOnly: true, //secure: true, maxAge : 60 * 60 * 1000 } })); I'm working on…
Pano
  • 1,439
  • 4
  • 13
  • 22
7
votes
2 answers

TypeScript: Extend Express.Session interface with own class

I'm working on a Typescript project with npm packages. I want to add a property to the Express.Session interface. example Class: class User { name: string; email: string; password: string; } export = User; New d.ts file for the…
Mr. Smith
  • 359
  • 4
  • 15
6
votes
1 answer

Node.js, Angular, express-session: Chrome 80 does not save session because of cookie policy (sameSite cookies)

I have a Node.js, Angular app. (Node.js server written in TypeScript). Node.js Server is running on an Amazon EC-2 instance, the Angular client is on another server. For the login session, I use express-session. I am not using cookies in the app, so…
6
votes
2 answers

Cookie not set with express-session in production

My app is divided between Client and Server. Client is a frontend side Nextjs app hosted on Now.sh, Server is its backend created with Express and hosted on Heroku, so the domains are client-app.now.sh and server-app.herokuapp.com…
The_Wolf
  • 155
  • 4
  • 11
6
votes
1 answer

Session is not correctly obtained from a storage, using express-session and passportjs

I'm using passport, express-session and connect-pg-simple. The problem is that session is not correctly obtained from a storage, where it gets properly (i hope, but doubt) saved. My setup is the same, as in many tutorials, I've found…
AntonAL
  • 14,493
  • 19
  • 71
  • 109
1
2
3
62 63