0

I've my application(react app) running in localhost:3000 & my express server running on https://some-domain.com, I'm unable to set cookie from my express to localhost. I'm using express-session & redis-store.

  • Maybe this could help: [https://stackoverflow.com/a/48231372/8962088](https://stackoverflow.com/a/48231372/8962088) It seems to be a CORS issue. – Grifo Aug 10 '23 at 20:05

1 Answers1

0

To set "credentials" in server we need this line:

res.header('Access-Control-Allow-Credentials', true) add this in cors middleware

This would let you handle credentials included in headers.

You also have to tell to axios to set credentials in headers with:

withCredentials: true

Akshay Darji
  • 111
  • 4