Fetch, set-cookies and csrf
<p>I m using Isomorphic fetch in my application and I m having some troubles dealing with CSRF.</p>

<p>Actually, I m having a backend that sends me a CSRF-TOKEN in set-cookies property :</p>

<p><a href="https://i.stack.imgur.com/duODj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/duODj.png" alt="enter image description here"></a></p>

<p>I have read somewhere that it's not possible, or it's a bad practice to access this kind of cookies directly inside of my code.</p>

<p>This way, I tried to make something using the credentials property of fetch request :</p>

<pre><code>const headers = new Headers({
            'Content-Type': 'x-www-form-urlencoded'
        });
        return this.fetcher(url, {
            method: 'POST',
            headers,
            credentials: 'include',
            body: JSON.stringify({
                email: 'mail@mail.fr',
                password: 'password'
            })
        });
</code></pre>

<p>This way, I m able to send my CSRF cookie back to my server to serve my need (it's a different one, because it s not the same request) :</p>

<p><a href="https://i.stack.imgur.com/OcotU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OcotU.png" alt="enter image description here"></a></p>

<p><strong>My problem</strong></p>

<p>My problem is that my backend needs to receive a x-csrf-token header and so I can't set it to my POST request.</p>

<p><strong>What I need</strong></p>

<p>How can I do to put the value of <em>set-cookies: CSRF-TOKEN</em> into the next request <em>x-csrf-token</em> header ?</p>