I am working with Angular 2 and I am trying to send HTTP request with credentials:
This Angular 1 code works well, it includes the credentials:
$http.get("http://some.com/user",{ withCredentials: true})
According to the API preview I have implemented this Angular 2 code but it does not include credentials:
http.get("http://some.com/user", {
headers: myHeaders,
credentials: RequestCredentialsOpts.Include
}).toRx()
.map(res => res.json())
.subscribe(
// onNext callback
data => this.successHandler(data),
// onError callback
err => this.failure(err)
);
I am working with Angular 2.0.0-alpha.37.
I'm using [email protected]
;
If you add code in xhr_backed.js
, You can send 'credentials' to server
this._xhr.withCredentials = true;
var XHRConnection = (function() {
function XHRConnection(req, browserXHR, baseResponseOptions) {
........
this._xhr = browserXHR.build();
this._xhr.withCredentials = true;
........
:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With