Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Session not created when logging in from other addresses

I'm trying to log into my production react app with the same credentials I used to log into my development react app. But logging into one, results in not being able to log into the other one simultaneously since I have put a validation on the back-end that prevents a user logging in from the same address(not different ones) twice if they're already logged in. The production one is one Netlify and the development one is on localhost.

I'm using express-session to store user data in a store with these configuration:

app.use(
  session({
    secret: process.env.SECRET,
    name: "pg.sessionId",
    saveUninitialized: false,
    resave: false,
    cookie: {
      maxAge: 1209600000, // 14 days
      httpOnly: true,
      secure: isProduction ? true : false,
      sameSite: isProduction ? "none" : "lax",
    },
    store: new pgSession({
      pool: db,
      createTableIfMissing: true,
    }),
  })
);

Everything was working fine until I changed the CORS Origin to allow multiple addresses to access it in this way:

// CORS
const cors = require("cors");
const options = {
  credentials: true,
  origin: isProduction
    ? [process.env.ADDRESS1, process.env.ADDRESS2, "http://localhost:3000"]
    : "*",
};

ADDRESS1 is the API Docs on Swagger

In the front-end, I have set the withCredentials of axios to true.

Why is this happening and how can I fix it?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!