Release 0.14.0-alpha #42
@@ -202,9 +202,9 @@ async function apiRequest<T>(
|
|||||||
// * We rely on HttpOnly cookies, so no manual Authorization header injection.
|
// * We rely on HttpOnly cookies, so no manual Authorization header injection.
|
||||||
// * We MUST set credentials: 'include' for the browser to send cookies cross-origin (or same-site).
|
// * We MUST set credentials: 'include' for the browser to send cookies cross-origin (or same-site).
|
||||||
|
|
||||||
// * Add CSRF token for state-changing requests to Auth API
|
// * Add CSRF token for all state-changing requests (Pulse API and Auth API).
|
||||||
// * Auth API uses Double Submit Cookie pattern for CSRF protection
|
// * Both backends enforce the double-submit cookie pattern server-side.
|
||||||
if (isAuthRequest && isStateChangingMethod(method)) {
|
if (isStateChangingMethod(method)) {
|
||||||
const csrfToken = getCSRFToken()
|
const csrfToken = getCSRFToken()
|
||||||
if (csrfToken) {
|
if (csrfToken) {
|
||||||
headers['X-CSRF-Token'] = csrfToken
|
headers['X-CSRF-Token'] = csrfToken
|
||||||
|
|||||||
Reference in New Issue
Block a user