docs: hint to use credentials: 'omit' for authenticated requests (#4369)

Co-authored-by: Hendrik Krebs <hendrik@MacBook-Pro-von-Hendrik.fritz.box>
This commit is contained in:
Hendrik Krebs
2025-09-02 16:21:01 -07:00
committed by GitHub
co-authored by Hendrik Krebs
parent 8849a9bcb3
commit d5081fde19
+5 -1
View File
@@ -362,7 +362,11 @@ const makeAuthenticatedRequest = async () => {
const headers = {
"Cookie": cookies, // [!code highlight]
};
const response = await fetch("http://localhost:8081/api/secure-endpoint", { headers });
const response = await fetch("http://localhost:8081/api/secure-endpoint", {
headers,
// 'include' can interfere with the cookies we just set manually in the headers
credentials: "omit" // [!code highlight]
});
const data = await response.json();
return data;
};