我正try 使用with Credentials向我的服务发送cookie,但无法找到如何实现它. 文档说"如果服务器需要用户凭据,我们将在请求标头中启用它们",但没有示例. 我已经try 了几种不同的方法,但它仍然不能发送我的cookie. 到目前为止,以下是我的代码.
private systemConnect(token) {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('X-CSRF-Token', token.token);
let options = new RequestOptions({ headers: headers });
this.http.post(this.connectUrl, { withCredentials: true }, options).map(res => res.json())
.subscribe(uid => {
console.log(uid);
});
}