[英]Angular 9 Intercom API, how to fix CORS error?
我正在嘗試訪問對講 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 錯誤?
Intercome apis 在客戶端不起作用。 您需要使用服務器端包在對講機上進行 api 調用。
您可以使用其中之一:
1- Nodejs http 客戶端包: axios
2- 官方節點包: intercom-node
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.