I am using fetch in my react website. So, the server is sending me a set-cookie as
set-cookie: sessionid=8pw2k1il82a7ecsqomouww1j9dt3i20f; HttpOnly; Path=/; SameSite=None; Secure
So, now i want send it as cookie in my request headers. I am new to this so having trouble on how to generate csrf token. here is the function where i want cookie request header.
return fetch(`${process.env.REACT_APP_BASEURL}/api-auth/check-session/`, {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
});
}