How do I use window.fetch() with httpOnly cookies or basic auth

后端 未结 1 978
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 17:13

I\'m playing around with window.fetch() in Firefox and Chrome. For some reasons, fetch() doesn\'t send any cookies. Now that wouldn\'t be a problem, as I can send them using

相关标签:
1条回答
  • 2020-12-28 17:48

    Okay, I found out after reading on the Mozilla Developer Network a bit more and trying out the credentials option.

    Looks like the credentials option is what I should have looked for.

    fetch('/something', { credentials: 'same-origin' }) // or 'include'
    

    Will send the cookies.

    0 讨论(0)
提交回复
热议问题