According to the CORS spec, withCredentials: true
can be set on an XHR or Fetch request to include authorization credentials in the pre-flight request.
I'm using the Request library (in the browser). How can I pass that property through? Simply including { withCredentials
} in the options like this doesn't seem to work:
request.get({
...,
auth: {...},
withCredentials: true
})
To answer my own question, I have confirmed that the Request
library does indeed support the withCredentials: true
option (or rather, one of its dependencies does), and it eventually gets translated into a credentials: "include"
parameter passed to fetch()
.
As noted in comments above, the behaviour of that is not what I was expecting, but the issue is not with Request.