Mixpanel JQL Cors 问题

Mixpanel JQL Cors Issue

我正在尝试从本地主机和 运行 调用 mixpanel jql api 进入 CORS 问题。

这是我的电话:

  try {
    const res = await axios({
      method: "post",
      url: "https://mixpanel.com/api/2.0/jql",
      data,
      withCredentials: true, 
      headers: { 
        "Content-Type": "application/x-www-form-urlencoded",
        "Access-Control-Allow-Credentials": 'true',
        "Access-Control-Allow-Origin": "*",
      },
      auth: {
        username: xxxxxxxxxxx,
      }
    });
    console.log(res.data);

  } catch(error) {
    console.log(error);
  }

这是浏览器中的错误:

Access to XMLHttpRequest at 'https://mixpanel.com/api/2.0/jql' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

如有任何帮助,我们将不胜感激。

原来他们阻止了本地主机:

https://help.mixpanel.com/hc/en-us/articles/115004511086-CORS-errors