Why is the cookies not sent along with the request initiated by fetch(url, {credentials: 'include'})?

Viewed 24

I manually set up a cookie at Google.ca using document.cookie = 'foo=bar’, which is a non http-only , not same-site and not secure cookie!

enter image description here

I then open up another tab and visit a different site bing.com and use fetch to send out a get request to google.ca with credentials option set to include:

fetch('https://www.google.ca/', {credentials: 'include'}).then(console.log)

I expected this request would bring the cookies set under google.ca which should include foo=bar since I addd credentials: 'include' . Of course this is a cross origin request but according to MDN, credentials: 'include' tells browsers to include credentials in both same- and cross-origin requests.

However I didn’t see any cookies included in the request from the network tab. I wonder if I am missing something here? Or I completely misunderstood how cookies work?

0 Answers
Related