I'm currently trying to send a cookie back to my react app after logging in, In my server I have a test response:
res.status(200).cookie('nameOfCookie', 'cookieValue', { maxAge: 1000* 60 * 60 }).end();
and in the app I have
Axios.post('http://localhost:5000/User/login', userDetails).then(res => {
console.log(JSON.stringify(res))
this.props.history.push('/list');
})
The response is recieved by call,
{"data":"","status":200,"statusText":"OK","headers":{"content-length":"0"},"config":{"url":"http://localhost:5000/User/login","method":"post","data":"{\"email\":\"a\",\"password\":\"a\"}","headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json;charset=utf-8"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1},"request":{}}
But no cookie ends up being set, could somebody tell me what the issue here is? Thanks-
I also have
app.use(cookieParser());
as the first app use, as that was recommended, but this did not help