const res = await fetch('/login', { method: 'POST', headers: { Accept: 'application/json', Cookie: document.cookie }, credentials: 'same-origin', body: JSON.stringify(data) }); Here is the piece of code that sends the authorization request. Authorization passes, and the server sends the header set-cookie. But the cookie is not installed (document.cookie = ""). Help in what could be the problem