I 'm authenticating with site https://a.com. Once I authenticate, I access http://b.com. a.com sets a cookie for the session that I need to send with when I make a get request from b.com to a.com.
Can you please tell me, how I can get the cookie and pass it on with my request.
I have tried sending the requests with "withCredentials": true, Also tried using the axios-cookiejar-support with tough-cookie. But doesn't seem to work.
.get(a.com/path-requiring-cookie, {
withCredentials: true,
headers: {
'Content-Type': 'application/json',
'access-control-allow-credentials': true,
},
})
.then(res => {
console.log(res.data);
});```
This is the code that I have to send the request.
But this doesn't seem to send the cookie with the request. Can someone please clarify.