Questions tagged [cookie-session]

Simple cookie-based session middleware for Express.js framework.

cookie-session is a simple cookie-based session middleware for Express.js framework.

94 questions
2
votes
1 answer

How to use cookie-session for node expresss.js

As express-session is not ready to work on production environments unless you change the module to something like redisStorage, I decided to go for cookie-session. The documentation doesn't seem to be very clear to me. It says Other options are…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
2
votes
0 answers

How to overcome IE11 caching express.js cookie-session?

I'm using express.js cookie-session in order to store my logged user session. Each time I'm signing in new user I'm putting a userId on his current session and assigning this userId to a user._id I created for him on my DB: req.session.userId =…
liron_hazan
  • 1,396
  • 2
  • 19
  • 27
2
votes
1 answer

How does the cookie-session middleware work in expressjs?

I want to know the underlying concepts of cookie-session in expressjs. When ever we stores something in session for example req.session.myName = "Manas Tunga"; where this session data is stored ?? is it in client side session cookies or in server…
manas
  • 6,119
  • 10
  • 45
  • 56
2
votes
0 answers

express.js cookie session expire and csrf

I'm using express.js and mongoStore and csrf in express.js and I want to maintain the login session for 24 hours. so my express configuration file is like this. // express/mongo session storage app.use(express.session({ secret: pkg.name, store:…
Eun Bit Hwang
  • 151
  • 1
  • 9
1
vote
0 answers

How can I handle 'Session Trampling' error while authenticating multiple sessions in the same browser with node-oidc-provider?

When we try to open multiple browser instances and try to login with same user credentials, we get different kinds of errors. The very first browser session is loaded fine but the further sessions throw error. "Something went wrong". When trying to…
1
vote
0 answers

cookie-session, socket.io fails to store socket.id in sessions

server.js const express = require("express"); const cookieSession = require("cookie-session"); const socketIo = require("socket.io"); const app = express(); app.use( cookieSession({ name: "session", keys: ["key1", "key2"], …
1
vote
0 answers

express req.session not populated

I have an express app where I'm using cookie-session for storing jwt token. I'm using supertest to test that app. So, here is what I'm trying to achieve: Here a cookie is created and jwt is stored inside. const request = require('supertest'); const…
1
vote
1 answer

How to delete cookie-session?

This is my code: var express = require('express') var sessionCookie = require('cookie-session') var app = express(); app.use(sessionCookie({ keys: ['abc'], name: 'user' })); app.get('/', function (req, res, next) { req.session.views =…
Hojat
  • 31
  • 1
  • 6
1
vote
0 answers

Check if express cookie-session has expired using passport isAuthenticated

I'm using express cookie-session: http://expressjs.com/en/resources/middleware/cookie-session.html I can not find the answer to this and based on some logging there is no way to see the time elapsed. So I'm trying to find a way to check this and see…
me-me
  • 5,139
  • 13
  • 50
  • 91
1
vote
1 answer

Express signed cookie vs JWT as cookie for Authentication

First let me start by saying, this is not a question of client token vs server-side session reference. I understand the differences and I've already decided on a session-less implementation. I've also decided to use cookies for client-side…
paultman
  • 405
  • 2
  • 9
1
vote
0 answers

Setting session data in cookie using cookie-session npm library

Description I'm currently trying to implement some session authentication logic in my node backend, but having issues in my development environment that I can't seem to troubleshoot. Backend: node with express Library: cookie-session Link to…
1
vote
0 answers

session is getting expired after closing browser in express.js

I used both cookie-session and express-session, I also specified maxAge but still, it's no use. const expressSession = require("cookie-session"); const IN_PROD = process.env.NODE_ENV === "production"; app.use( expressSession({ name:…
1
vote
0 answers

I lost all css when i set cookies expire

I lost all css when i set cookies expire = 0. My website still work fine when compile it in local. But when i deploy it to public server, all css can't loaded. cookies.set("token", res.data.data.token, { expires: 0, }); …
thaovd1712
  • 120
  • 1
  • 1
  • 9
1
vote
1 answer

Express cookie-session not creating cookie on client side

I have a simple ExpressJS app that is using cookie-session to create a cookie. I have a few routes defined but none are returning a cookie. The documentation for cookie-session says that req.session needs to be altered to set the cookie, which is…
user3809888
  • 377
  • 1
  • 6
  • 23
1
vote
0 answers

Remove httponly from cookie when making HTTP call using Flutter

I have an Express application that has a cookie-based authenticated route. I am using cookie-session to store auth tokens in the cookie. I am developing a mobile app using Flutter and am using the requests package to manage cookies while making HTTP…
Nikhil Baliga
  • 137
  • 1
  • 1
  • 8