Configure Axios and Flask to use CORS with cookies
The code looks like you are defining withCredentials
as a HTTP header. But that's not exaclty how it works.
withCredentials
is actually an option which will enable a http header, but it's not a http header in itself.
Try creating the promise like this:
const axiosWithCookies = axios.create({ withCredentials: true});const promise = axiosWithCookies.get(url);
The resulting http header will actually look as follows.But you don't have to add this manually. This will be taken care of if you create the axios instance as above.
Cookie: JSESSIONID=...