Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 4.3 XSRF HttpClientModule

Tags:

angular

I'm implementing CSRF protection within my angular project. I've upgraded to 4.3, and according to HttpClientModule docs at:

https://angular.io/guide/http#security-xsrf-protection

I have to implement,

 HttpClientXsrfModule.withConfig({
cookieName: 'My-Xsrf-Cookie',
headerName: 'My-Xsrf-Header',
  }),

I've done so, however the compiler complains:

Property 'withConfig' does not exist on type 'typeof HttpClientXsrfModule'.

like image 310
Taranjit Kang Avatar asked Aug 19 '26 20:08

Taranjit Kang


1 Answers

this is a typing issue in the documentation.

You need to use "withOptions" instead.

HttpClientXsrfModule.withOptions({
  cookieName: 'My-Xsrf-Cookie',
  headerName: 'My-Xsrf-Header',
})
like image 51
FrenchTastic Avatar answered Aug 24 '26 04:08

FrenchTastic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!