問題描述
我想在應用程序安裝期間與 BigCommerce 交換信息,并從 html 頁面發送代碼的 POST 請求.但是我一直被 CORS 阻止:請求的資源上沒有 'Access-Control-Allow-Origin' 標頭.".而且我在 BigCommerce API 文檔中找不到任何相關信息.
I want to exchange information with BigCommerce during application installation and send POST request for code from html page. But I keep getting blocked by CORS: " No 'Access-Control-Allow-Origin' header is present on the requested resource.". And I cannot find anything about it in BigCommerce API documentation.
有人知道嗎,支持嗎?有沒有辦法在瀏覽器中從 javascript 調用 BigCommerce api?
Do somebody know, is it supported? Is there any way to call BigCommerce api from javascript in browser?
推薦答案
我們不支持 CORS.嘗試在瀏覽器中直接從 javascript 調用 API 是非常不安全的.這會公開一個 API 令牌,使某人能夠通過基本身份驗證訪問存儲中可用的任何數據.這將包括 PII.
We do not support CORS. It is very insecure to try to call the API from javascript on in the browser directly. This exposes an API token which enables someone to have access to any data in the store available through basic authentication. This would include PII.
如果您確實需要從 API 調用信息,請使用安全的 Web 服務,該服務會向您的腳本返回非常具體的值,而不是直接調用它.
If you really need to call info from the API, please use a secure web service that returns very specific values to your script as opposed to calling it directly.
這篇關于BigCommerce API 是否支持 CORS?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!