Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 9对讲机API,如何修复CORS错误?_Angular_Intercom - Fatal编程技术网

Angular 9对讲机API,如何修复CORS错误?

Angular 9对讲机API,如何修复CORS错误?,angular,intercom,Angular,Intercom,我正在尝试访问内部通信API,并使用他们的API在那里创建一家公司 但是得到CORS的错误 URL = 'https://api.intercom.io/companies' this.httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', 'Authorization': 'Bearer ....', 'Access-Control-Allow-

我正在尝试访问内部通信API,并使用他们的API在那里创建一家公司 但是得到CORS的错误

URL = 'https://api.intercom.io/companies'

this.httpOptions = {
    headers: new HttpHeaders({
      'Content-Type':  'application/json',
      'Authorization': 'Bearer ....',
      'Access-Control-Allow-Origin': '*'
    })
 };

const path = this.URL + '/companies';
return this.http.post(path, data, {headers: this.httpOptions});


如何修复CORS错误?

内部通信API在客户端不起作用。 您需要使用服务器端包在对讲机上进行api调用

您可以使用其中之一:

1-Nodejs http客户端包:
axios

2-正式节点包:
内部通信节点