Javascript withCredentials:true在Firefox中不使用angular2
我有一个服务试图在angular2中发出HTTP请求,带有with credentials:true标志,这样我就可以发送用户工作站凭据,而不是手动键入,但它在最新版本的Chrome和IE11中运行良好,但在Firefox 54.0.1(32位)中不起作用 我怎样才能避开这个问题?任何人都可以帮助我 反应.服务.tsJavascript withCredentials:true在Firefox中不使用angular2,javascript,angular,firefox,Javascript,Angular,Firefox,我有一个服务试图在angular2中发出HTTP请求,带有with credentials:true标志,这样我就可以发送用户工作站凭据,而不是手动键入,但它在最新版本的Chrome和IE11中运行良好,但在Firefox 54.0.1(32位)中不起作用 我怎样才能避开这个问题?任何人都可以帮助我 反应.服务.ts 从'@angular/core'导入{Injectable}; 从'@angular/Http'导入{Http,Headers,Response,RequestOptions};
从'@angular/core'导入{Injectable};
从'@angular/Http'导入{Http,Headers,Response,RequestOptions};
进口“rxjs/Rx”;
从“rxjs/Observable”导入{Observable};
@可注射()
导出类ReactionService{
构造函数(私有http:http){}
getReaction(ruid){
常量头=新头();
headers.append('Content-Type','application/x-www-form-urlencoded');
headers.append('Accept','application/json');
常量body='ruid='+ruid;
const options=newrequestoptions({headers:headers,withCredentials:true});
返回此.http.post('https://serviceUrl,主体,选项)。映射(
(回复:回复)=>{
const data=response.json();
控制台日志(数据);
返回数据;
}
).接住(
(错误:响应)=>{
console.log(错误);
返回可观察抛出(错误);
}
);
}
}
您检查控制台了吗?你有什么错误吗?@samnupel我没有收到任何错误消息,只是收到了这条消息`Object{u body:error,status:0,ok:false,statusText:,headers:Object,type:3,url:null}
你检查控制台了吗?你有什么错误吗?@samnupel我没有收到任何错误消息,只是收到了这条消息`Object{u body:error,status:0,ok:false,statusText:,headers:Object,type:3,url:null}