NoSkill NoSkill - 5 months ago 450
AngularJS Question

Angular 2 GET withCredentials (to accept cookies from server)

I can see that

withCredentials: true
is implemented in angular 2 now

To accept cookies from server.

However I am not sure how I supposed to use it.

I tried

this.http.get( API_PATH + 'auth/getSession/' + TOKEN, {
withCredentials: true
} )


But Broccoli throws error

Argument of type '{ withCredentials: boolean; }' is not assignable to parameter of type 'RequestOptionsArgs'


I use 1.0.0-beta.6 of Angular CLI.

Answer

withCredentials is usable from the RC2 version of Angular2. Angular CLI 1.0.0-beta.6 uses the RC1 version.

You should upgrade to beta.8 to be able to use version RC2+.

Comments