I have an endpoint to verify a login token, the response of this request returns a set-cookie header that looks like this
mysession=MTcxMzg4NDgzMXxOd3dBTkU1U05GUkpXVU5aU2tWVU4wdzJTRk5ITTBkRlZGVkJVMU5GVlZGT1ZWcENNazFWV0RaQ1Z6WlhObFJLUTBoTFUwdE5VbEU9fKtFvBvTqDaTESXaZgbkfRBhxL8qcC7w5VvA2KxiDPLR; Path=/; Expires=Thu, 23 May 2024 15:07:11 GMT; Max-Age=2592000
I need this cookie to make subsequent requests but the cookie is not getting sent despite me setting “mode:cors” and “credentials:include”. I have checked the server configuration and everything works properly when I test on postman and when I edit the request manually through firefox to include the Cookie that is returned by the previous request
The issue is that there’s no cookie being sent in the next request, this is the code I have to make the request:
const response = await fetch(`${process.env.BACKEND_URL}/account/profiles`, {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`
},
credentials: 'include',
mode: 'cors'
});
As I said, If I manually include the cookie obtained in the previous request to make the subsequent request I get a 200 response from the server, otherwise it doesn’t work
Is there a way to fix this? I’m aware there are a lot of similar questions but none of the responses have been helpful, the backend is configured properly and I’ve tried other browsers (Chrome, Firefox, Safari) and I get the same result in all of them