I am trying to fetch data from my api, I need to pass a cookie in the header. I tested on postman, and it works, but I does not work in my code, the return error is 403. Any ideas what I am missing ?
Thanks
here is my code:
function LoadStudies() {
const config = {
headers: {
Cookie: '_ga=GA1.2.2139220028.1611912340;csrftoken=ADJBapIX3oLu3j8QHdD05zsJnDhzx0jDYtAjKV2GY0FkBzVNfdLY8xVMV1YF4Ibd;djdt=show;sessionid=0x40wumk8ehcb4boh6610pqud5wtqsjl;session_state=4f7e11af-abd0-4f9f-8357-611100821df3'
},
withCredentials :true,
}
console.log(config)
axios
.get("https://Domain/api/study/", config)
.then((response) => {
console.log('working!')
}).catch((error) => {
console.log(error)
});
}
LoadStudies();