簡體   English   中英

連接到Amazon Product Advertising API時出現“ Access-Control-Allow-Origin”錯誤

[英]“Access-Control-Allow-Origin” error when connecting to Amazon Product Advertising API

我試圖通過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密鑰暴露給客戶端。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM