【发布时间】:2020-10-15 06:14:26
【问题描述】:
我正在尝试访问对讲 API 并使用他们的 API 在那里创建一家公司 https://developers.intercom.com/intercom-api-reference/reference#create-or-update-company 但出现 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 错误?
【问题讨论】: