Using window.fetch() with Cookies

Have you ever found that using window.fetch() doesn’t automatically send your session’s cookies back to the server?

Simply modify your code to the following and it’ll all work nicely again!

fetch('/api/endpoint', {
    credentials: 'same-origin'
}).then(//...

Published by

Matt Arnold

Snake-keeper/Sysadmin

Leave a Reply