Send cookies
suggest changeIn current browsers, fetch sends cookies on same-origin requests by default (credentials: 'same-origin'). Early implementations defaulted to 'omit'. Use 'omit' to send none, and 'include' to send them on a cross-origin request as well. A cross-origin response is still hidden unless the server sends Access-Control-Allow-Credentials: true and a specific Access-Control-Allow-Origin.
fetch('/login', {
credentials: 'same-origin'
})
fetch('https://otherdomain.com/login', {
credentials: 'include'
})
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents