Open JaydenCS opened 1 day ago
Looks like your request does not have the cookie attached that contains the JWT, how are you making the request?
Just like you said in the document:
Here is the code:
const FastAPITest = async () => {
try {
const csrfToken = await getCsrfToken();
console.log(csrfToken);
const response = await fetch("http://localhost:8000/", {
method: "POST",
headers: {
"X-XSRF-Token": csrfToken,
},
credentials: "include",
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
console.log(response.json);
} catch (error) {
console.error("Error making authenticated request:", error);
throw error;
}
Was just setting up and testing using the following code
The Error: