我在api上制作http.post并禁止错误403
这段代码没有给我浏览器的错误测试,但如果我尝试Android设备给我错误
我该如何解决这个问题。
Thanx到现在
kanallistele()
{
var veri;
this.kanallardiv=true;
this.uyegirisdiv=false;
this.kanallistelebtn = false;
var headers = new Headers();
headers.append('Accept', 'application/json');
headers.append('Content-Type', 'application/json' );
//headers.append('Authorization' , 'Basic '+ btoa(tok));
let options = new RequestOptions({ headers: headers });
let postParams = {
token: "381f13d7056-ce5fe474919",
user_id: "71",
}
var veris="channel_name_";
this.http.post("https://iothook.com/api/v1.0/channels/", postParams, options)
.subscribe(data => {
veri = data['_body'];
console.log(veri);
veri= veri.slice(1, -1);
veri = veri.replace(/\\/g, "");
veri = JSON.parse(veri);
for(var i = 0 ;;i++)
{
if(!veri.channel_list['channel_name_' + (i)])
break;
this.veriler.push({channelname: veri.channel_list['channel_name_' + (i)],channelid: veri.channel_list['channel_id_' + (i)]});
}
}, error => {
console.log(error);// Error getting the data
});
}