【问题标题】:Angular 9 Intercom API, how to fix CORS error?Angular 9 Intercom API,如何修复 CORS 错误?
【发布时间】: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 错误?

【问题讨论】:

    标签: angular intercom


    【解决方案1】:

    对讲API在客户端不起作用。 对讲机需要使用服务端包进行api调用。

    您可以使用其中之一:

    1- Nodejs http 客户端包:axios

    2- 官方节点包:intercom-node

    【讨论】:

      猜你喜欢
      • 2021-07-02
      • 1970-01-01
      • 2021-11-30
      • 2020-12-06
      • 2020-08-21
      • 2020-09-01
      • 2022-08-14
      • 2021-03-25
      • 2022-01-20
      相关资源
      最近更新 更多