Questions tagged [express-session]

Simple session middleware for Express

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

937 questions
0
votes
2 answers

node.js - Can't figure out how to sabe sessions with session-express

I'm new to node.js and sessions, I'm trying to store some values in the node.js session, but everytime I reload the page and check the console.log the session haven't been saved. My code: var session; var org; function checkSession(argument){ var…
Pablo
  • 471
  • 8
  • 16
0
votes
1 answer

Automatically remove mongodb document after period of inactivity

I need to remove mongodb documents after a specified period of not being accessed. I have a access token I use to retrieve data from an external source and save it in my database. In my session I store a user id I can use the retrieve the access…
jalbasri
  • 318
  • 2
  • 13
0
votes
0 answers

Update EJS Layout with Session

My ejs layout provides the current user's username on the main menu through sessions <% if (typeof currentUser === 'undefined'){%> <% } else { %>
0
votes
1 answer

express-session, read vars on socket.io interaction

I am making a chat for customers of a web page, with express.js, and socket.io, and I'm trying to manage sessions with express-session, my problem is, how do I read the session values on the socket. Here's part of my code. Thanks for the help :) var…
0
votes
2 answers

Express session inside callback comes back undefined outside

I have a route written in Express as the following: app.get("/route", function(req, res){ if (someBoolean){ someFunction(stuff, function(user){ ... req.session.user = user; }); } …
alibman
  • 33
  • 6
0
votes
0 answers

Having difficulties with session variables persisting across requests

My application is currently being opened from my file system and makes requests to a server hosted on cloud 9. Whenever I submit information from the same page I make two requests from the same page. One request is to create a new resource and the…
Alan
  • 944
  • 2
  • 9
  • 20
0
votes
0 answers

NodeJS + ExpressJS User Login

I am currently working on a web application that requires an user login snippet. I have built an API for getting user information and others. But I cannot let NodeJS work with sessions. So, I have an API endpoint like this for logging in:…
Ali Demirci
  • 4,518
  • 6
  • 33
  • 60
0
votes
0 answers

Node Express Session revocation on re-issue?

Using node v12, Express 4, and connect-pg-simple During our security evaluation is was discovered that if a user logs in successfully, and logs in again successfully, that the prior session remains valid. I'd like for the second login to revoke the…
user9170
  • 790
  • 6
  • 14
0
votes
0 answers

Express session secret - from client to server?

I am using express-session with Express 4. I am confused about how I pass the secret from the client to the server. I assume that I need to pass the secret for every request, otherwise I don't really understand what the secret is for. var session =…
0
votes
1 answer

Sending XmlHttpRequest with session (again)

I have a page and I want to track what the current user is doing. For this, the server gives him an id, and than, I'd like to send a XmlHttpRequest to log information, and I'd like to keep its id. However, the request received by my server as an…
tforgione
  • 1,207
  • 15
  • 28
0
votes
1 answer

Node.js: Why not saved session?

Here's the code: app.get('/vklogin', function(request, response) { console.log('Авторизация через соц.сеть "Вконтакте"'.green); var url_parts = url.parse(request.url, true); var query = url_parts.query; var data = querystring.stringify({ …
Octoloper
  • 163
  • 1
  • 8
0
votes
0 answers

Express Session Getting Overwritten

I have Express with Passport authentication and have added session to it as below. app.use(cookieParser()); // read cookies (needed for auth) app.use(bodyParser()); // get information from html forms app.set('view engine', 'ejs'); // set up ejs for…
skumar
  • 41
  • 6
0
votes
2 answers

How to redirect to last action in sailsjs using req.session?

I am creating a login application where I need to redirect back to previous url from where the login action was called. I need to know does sails provide a built-in method by using which I can redirect to previous action without creating my own…
Rohit Choudhary
  • 2,191
  • 1
  • 21
  • 33
-1
votes
1 answer

Express-session is not setting cookies in browser

So I'm using express-session package to set cookie and session. It's also connected to my MongoDB store to store session. When user logs in, session gets stored in database just fine but there's no cookie in the browser. My app is running in…
-1
votes
1 answer

With node.js / express-session is it possible to save() just one property on the session?

Environment: Node.js, Express, express-session Question: Is it possible to save just one property of a session instead of saving over the entire session? Background: Normally express-session saves the session at the end of each http response, i.e.…
myNewAccount
  • 331
  • 1
  • 7
1 2 3
62
63