我在响应标头中收到了Cookie,但我无法将它们存储在浏览器Cookie中,因为浏览器没有自动保存它。有人可以帮我这个吗?
注意:我已尝试withCredentials:true
和crossDomain:true
以及所有其他可用选项。
this.headers.set("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
this.headers.set("dataType","json");
this.headers.set('crossDomain','true');
this.headers.set('Access-Control-Allow-Origin','*');
this.headers.set("Access-Control-Allow-Credentials","true");
this.headers.set("Access-Control-Allow-Headers","*");
let options = new RequestOptions({headers:this.headers,withCredentials: true,params:data});
this.http.post(this.API_URL+this.BASE_URL+'auth/login/',options).subscribe(data => {
console.log(document.cookie);
this.router.navigate(['/dashboard']);
}, error => {
var display=error.json();
this.error='* '+display.message;
});