获取授权和cors?

Fetch with authorization and cors?

有没有办法从不同来源的浏览器调用 clash royale API

API 需要授权 header。

我正在尝试使用 fetch(),但无论我是否使用模式 cors,它都不起作用。

为了使用 API,文档说,

Keys help in controlling access and traffic to the API. When creating a key you need to specify the IP addresses that are allowed to access the API endpoints.

所以基本上你创建一个 API 令牌并指定调用 API 的 IP 地址。在这种情况下,API 将允许列出的 IP 地址进行呼叫。