Questions tagged [express-session]

Simple session middleware for Express

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

1209 questions
0
votes
0 answers

Nodejs/Express Session - Error: Can't set headers after they are sent

I am getting the below error while trying to use express session with a simple nodejs sample app. When "resave" is set to true the below error appears, however when the same is set to false, there is no error. GET / 304 13.380 ms - - Error: Can't…
user3868848
  • 133
  • 2
  • 10
0
votes
1 answer

My Node.js web app establishes new session every time I reopen the browser

Every time I close all the browser windows and then open the web app again, a new session is established, that means I have to authenticate again. For your reference, I use express@4.14.0 as the web application framework, express-session@1.14.1 +…
kitlee
  • 110
  • 8
0
votes
0 answers

express-session + express res.render throwing "TypeError: Converting circular structure to JSON"

I have an Express JS app that uses express-session for session management. I am trying to save some values to session in controller A and consume them in controller B, and send them as context to a template like so: controllerA: function(req, res,…
nikjohn
  • 20,026
  • 14
  • 50
  • 86
0
votes
1 answer

session will be deleted after close browser nodejs

We used express-session. our code for session: app.use(session({ secret: config.SESSION_SECRET, saveUninitialized: false, resave: false, HttpOnly: true, store: new MongoStore({ mongooseConnection: mongoose.connection, …
user2707504
  • 1
  • 1
  • 2
0
votes
1 answer

express session-file-store session count not view-count

I am using express-session for session management in my node js application. using session-file-store. I want to count the number of sessions, to restrict new sessions after maxAllowed sessions. Is there any method supported for doing that? I dont…
Ekayaa
  • 169
  • 16
0
votes
1 answer

Handling 2 sid in express session

I have a scenario below as On browser I open a website in which after getting authenticated with the system(i.e. access.abc.com) I get a cookie and I set it on client, i.e. connect.sid with domain as .abc.com On same browser I open another webiste…
Mozak
  • 2,738
  • 4
  • 30
  • 49
0
votes
1 answer

How to use variable as secret key in express-session's session object

I have an express.js file which requires config.js which loads development.js. Now I want to use secret as a variable in session object of express-session. I will give you a quick breakup of how I had setup my code so far. Config folder Env --…
HalfWebDev
  • 7,022
  • 12
  • 65
  • 103
0
votes
2 answers

Express creating new session for each request

Express-session is creating a new session (new sessionID) for new request. And it happens intermittently, for example sometimes for first 3-4 hits it will work fine and keep using same existing session and on 4th hit it will create a new one,…
G.D
  • 305
  • 5
  • 18
0
votes
1 answer

express sessions do not work - new session upon every request

I use express-session to set up session management in the following way: var express = require('express'); var session = require('express-session'); var app = express(); var mongoose = require('mongoose'); var MongoStore =…
Timo
  • 3
  • 1
0
votes
0 answers

Handle sessions using Express-Sessions

Im new working with nodeJS. I have a webpage (with AngularJS) in a AWS ec2-server that gets information from a nodeJS(Express) server. Im trying to keep logged my users once they log in, even if they refresh. I have read that I can do that using…
Cesar Borge Mora
  • 253
  • 2
  • 3
  • 10
0
votes
1 answer

in node.js with express req.session is undefined inside my require() module

I'm wondering why req.session.username is undefined in the tag >>>DOESNT WORK<<< while it does work in the tag >>>THIS DOES WORK<<< . I brought in req as an argument to my module but it seems I'm supposed to do something else? The /ajax route is…
0
votes
1 answer

Node.js: to res.render or to res.redirect? express-session

I have two pages, login and myservices. After a user logs in, they will be brought to myservices page, and their username should be shown. in login.js, I have: req.session.user = "abc"; res.redirect('/myservices'); and in myservices.js, I…
Louis.L
  • 13
  • 1
  • 4
0
votes
0 answers

Express sessions getting mixed up for some users with Passport.js

I am running an Express node.js app that allows users to login with the PassportJS local or LinkedIn strategies and, for most users, that's working fine - they log in and see their profiles. For a small set of users (maybe 5%), when they first click…
Wikooo
  • 29
  • 5
0
votes
1 answer

TypeError: app.use() requires middleware functions at EventEmitter.use

i have a problem with Node.js running on a raspberry pi with linux operating system. On my local computer the program just runs fine. But as soon as i start it on the pi I receive following error message TypeError: app.use() requires middleware…
clyx
  • 82
  • 1
  • 8
0
votes
2 answers

Express Postgres Sessions not working correctly

I'm using express-session and trying to use Postgres as my session store: app.use(session({ store: new (require('connect-pg-simple')(session))(), secret: 'mysessionsecret', resave: false, cookie: { maxAge: 7 * 24 * 60 * 60 *…
Shamoon
  • 41,293
  • 91
  • 306
  • 570