Angular 5 unable to get XSRF token from HttpXsrfTokenExtractor

前端 未结 1 1302
旧时难觅i
旧时难觅i 2021-02-07 16:20

I am trying to make a POST request via an absolute URL to a Spring (Basic authentication) secured Rest API.
Having read that Angular omits inserting the

1条回答
  •  囚心锁ツ
    2021-02-07 16:43

    Since you are using different ports (3000 & 8080), you are making a cross-origin request, so you will not be able to read the cookie in the client sent from the server. If you want to separate your client and server in this way, you need to use a proxy so the client and server applications are served from the same protocol (http/https), domain, and port. If you are using Spring Boot I would suggest you look at Spring Cloud Netflix, specifically Zuul (https://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#_router_and_filter_zuul).

    0 讨论(0)
提交回复
热议问题