When I send a request for replenishment endpoint, I have encountered below problem on browser console side. How can I solve this problem?
Problem:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource .Origin 'https://mywebsite.com' is therefore not allowed access. The response had HTTP status code 404.
Request:
var xhr = new XMLHttpRequest(); xhr.addEventListener("readystatechange", function() { if (this.readyState === 4) { console.log("responseText:" + this.responseText); } });
var slot_id = "xxxxxxxxxx";
xhr.open("POST", "https://dash-replenishment-service-na.amazon.com/replenish/" + slot_id, true); xhr.setRequestHeader("Authorization", "Bearer (" + access_token+")"); xhr.setRequestHeader("x-amzn-type-version", "com.amazon.dash.replenishment.DrsReplenishInput@1.0");
xhr.setRequestHeader("x-amzn-accept-type", "com.amazon.dash.replenishment.DrsReplenishResult@1.0");
xhr.send();
Thanks,
Gizem.