我正在尝试通过 javascript 访问 Amazon Product Advertising API,但是无论我使用的是 axios 还是像 apac 这样的一体式解决方案,我都会收到“Access-Control-Allow-Origin”错误。我在亚马逊的文档中没有看到关于如何解决这个问题的任何地方。
这是错误:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access.
If an opaque response serves your needs, set the request's mode
to 'no-cors' to fetch the resource with CORS disabled.
我也没有看到任何地方记录如何将请求模式设置为“no-cors”。有没有人有解决方法?
此 API 旨在供服务器端应用程序使用。它不是为 Javascript 应用程序设计的——这样的使用是不安全的,因为您会将 API 密钥暴露给客户端。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句