Spring Security session JSESSIONID

后端 未结 1 1049
一向
一向 2021-01-15 05:53

I am currently developing a REST API with Spring Boot for an Angular2 frontend app.

I use Spring Security to manage user authentification but I need to store some in

相关标签:
1条回答
  • 2021-01-15 06:26

    It seems to be an angular2 issue which doesn't send cookie; I set this code in my constructor before calling my REST api :

     constructor(private _http: Http) {
            let _build = (<any>_http)._backend._browserXHR.build;
            (<any>_http)._backend._browserXHR.build = () => {
                let _xhr = _build();
                _xhr.withCredentials = true;
                return _xhr;
            };
        }
    

    And now my JSESSIONID is sending in every request.

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