I have my react app running on localhost:3000 & my node server api on localhost:9000
app.use(cors());
app.use(session({
secret: 'secret'
resave: false,
saveUninitialized: false,
cookie: {
domain: 'localhost',
secure: false
},
store: new MongoStore({
mongooseConnection: db,
autoRemoveInterval: 1,
ttl: 259200 // 3 days
})
}));
When a user authenticates, this works only when I serve my application from localhost:9000 but not from localhost:3000. I know the rule is that browsers don't set cookies from different domains. But is there a way achieve what I'm attempting without using local or session storage in the browser?