angular4 httpclient csrf does not send x-xsrf-token

前端 未结 3 1138
猫巷女王i
猫巷女王i 2020-12-02 21:06

In angular documentation, it is mentioned that the angular httpclient will automatically send the value of cookie XSRF-TOKEN in the header X-

3条回答
  •  -上瘾入骨i
    2020-12-02 21:18

    I suppose the correct method is withOptions. I used withConfig and got error Property 'withConfig' does not exist on type 'typeof HttpClientXsrfModule'. This is a typing issue in the documentation. You need to use "withOptions" instead HttpClientXsrfModule.withOptions({ cookieName: 'My-Xsrf-Cookie', headerName: 'My-Xsrf-Header', })

提交回复
热议问题