I have an API from trendyol.com (it is an e-commerce platform for Turkey)
When I try to get my products informations with api (it uses basic auth) I get CORS error (while dataType is "json"). If I change it as "jsonp", I get ERR_ABORTED 401 error. My auth informations are true, I am sure about this topic. Probably I have a problem about CORS. I am sending this request from my web page. (enginorun.xyz) I am not using chrome extension to ignore cors because if I develop my app with extension, will it work when I disable the extension. I am not sure. Please help me
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Trendyol Api Test</h1>
</body>
</html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var url = "https://api.trendyol.com/sapigw/suppliers/supplier.id/products";
var username = "-";
var password = "-";
var settings = {
'cache': false,
'dataType': "jsonp",
"async": true,
"crossDomain": true,
"credentials": "include",
"url": url,
"method": "GET",
"headers": {
'Access-Control-Allow-Origin': '*',
"Authorization": "Basic -----",
"accept": "application/json" }
}
$.ajax(settings).done(function (response) {
console.log(response);
});
</script>