Questions tagged [express-session]

Simple session middleware for Express

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

937 questions
4
votes
1 answer

Cross-Domain Session Cookie (Express API on Heroku + React App on Netlify)

I have a React App making calls to an API in node.js/Express. Frontend is deployed in Netlify (https), Backend deployed on Heroku (https). My problem: Everything working in dev environment (localhost) In production (Netlify/Heroku), the api calls…
ludovico
  • 1,083
  • 7
  • 21
4
votes
1 answer

How Session Data is stored in NodeJS in server-side?

I am a beginner in NodeJS. I was working on a simple session-based user authorization to get a taste and it is working perfectly fine as there are plenty of examples around the internet which are easy to understand. I used express-session and the…
4
votes
0 answers

Node Express-Session & React Frontend not storing Cookie with Axios

Fellow web developer here. I seem to be running into this problem (that didn't occur until recently) where the cookie Session ID gets changed on every API request. Edit Confirms to work in IE11 & Edge!? Not Chome?! WTF! Doesn't work with fetch and…
Whatty
  • 69
  • 1
  • 5
4
votes
0 answers

Connect-pg-simple not saving session to database

I am trying to implement simple authentication with Node, Express, Express-Session and Passport.js. As a storage middleware I'm using connect-pg-simple as I am using pg-promise in my project. I managed to configure passport to work with my routers…
Fiffe
  • 1,070
  • 2
  • 12
  • 22
4
votes
1 answer

set up mssql-session-store in node.js

I'm trying to use mssql-session-store as nodejs (express) store for session: https://www.npmjs.com/package/mssql-session-store This is how it should be configured(from npm page): app.use(session({ secret: 'keyboard cat', resave:…
Guy E
  • 1,193
  • 2
  • 11
  • 32
4
votes
0 answers

Trouble setting cookies with Express.JS + Nginx

I am in the middle of decoupling my frontend from my backend repo. In doing so I am hosting my server on a personal Raspberry Pi 3 on my home network. My frontend is hosted by Netlify. I have run into a problem where I am not able to set cookies on…
user3079061
  • 199
  • 3
  • 11
4
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
  • 155
  • 4
  • 11
4
votes
3 answers

Simple Node/Express app not recognizing Session store

I have an extremely small express app to illustrate a problem I'm having. I'm using connect-redis as a session store on my express app. I'm having a problem simply connecting to it though. Simply printing out req.session.store results in undefined…
qarthandso
  • 1,760
  • 1
  • 20
  • 35
4
votes
1 answer

(Next.js, Express session) New session for every request made inside getInitialProps

I am trying to make Express session work with Next.js, and have successfully done so on the client side, but I am having trouble with API calls made from inside getInitialProps. Note: I am using isomorphic-unfetch to make API calls. My Next.js…
Robert
  • 161
  • 1
  • 8
4
votes
0 answers

Node express session not persisting in IPhone IOS

I have an application using Angular and Node (Nest JS) , in the server side i'm using express-session. In my middleware i'm adding the logged in user to the session: req.session.user = user; When the user tries to login using an Iphone he is not…
Shahar Shmaram
  • 193
  • 2
  • 10
4
votes
2 answers

Express-session not persistent after redirect

Yesterday, I tried to make a website, using Node.js and the framework Express.js. On this website, the user needs to log, with credentials, who are checked in database. If the credentials are correct, I want to save the user's informations in a…
Dracoctix
  • 41
  • 1
  • 3
4
votes
2 answers

How To Access Session Variables From Seperate Route Files

I am currently using express and express-session to save information. If I save a session variable like this in file 'routes/login.js' req.session.user = "User1" How do I then access that same variable from 'routes/index.js' because currently if I…
Undying
  • 141
  • 2
  • 14
4
votes
1 answer

What is a secure session secret?

I am using express-session and I need to create a session secret. I have read that the secret is used for hashing. How long and what characters should this secret have? I was thinking about a random alphanumerical string like this:…
Luud van Keulen
  • 1,109
  • 9
  • 34
4
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
  • 157
  • 2
  • 12
4
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
  • 34,234
  • 12
  • 103
  • 151