Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

334
Visualizações
Ajax Get Request Cors AND ERR_ABORTED 401 Error

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>

If I use jsonp error; error image

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda