set withCredentials to the new ES6 built-in HTTP request API : Fetch

Abdennour TOUMI picture Abdennour TOUMI · Nov 11, 2016 · Viewed 19.7k times · Source

How to set withCredentials=true to fetch which return promise. Is the following correct :

fetch(url,{
   method:'post',
   headers,
   withCredentials: true
});

I think the MDN documentation talked about everything about http-requesting except this point: withCredentials

Answer

Abdennour TOUMI picture Abdennour TOUMI · Nov 11, 2016

Got it here :

  credentials: 'include'

and not

  withCredentials: true