相关疑难解决方法(0)

angular 2 http withCredentials

我正在尝试使用withCredentials将cookie发送到我的服务但无法找到如何实现它.文档说"如果服务器需要用户凭据,我们将在请求标头中启用它们"没有示例.我尝试了几种不同的方法,但它仍然不会发送我的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);
    });
}
Run Code Online (Sandbox Code Playgroud)

angular2-services angular2-http angular

40
推荐指数
3
解决办法
5万
查看次数

标签 统计

angular ×1

angular2-http ×1

angular2-services ×1