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

243
Visualizações
Access to fetch has been blocked by CORS policy - Fetch() JS issue

I have to update the profile's property in klaviyo with API. so I made this JS. but for some reasons, it doesn't work with me! This is API guide to update profile's property. I followed it but showing this issue! Could someone help me to fix this issue? many thanks

enter image description here

https://apidocs.klaviyo.com/reference/profiles#update-profile

  const options = {method: 'PUT', headers: {'Accept': 'application/json', 'Access-Control-Allow-Origin': '*'}};

  fetch('https://a.klaviyo.com/api/v1/person/01FHGADW5PW4SF33JMWPSN9KQX?api_key=pk_d3af8ba75d110725231231ba795f05ffe77fb&$locale=es-US', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Also, this ajax's result is the same. still showing the same issue. I'd like to get profile info! The first is to update the profile, second is to get profile info. but all is not working! very sad!

  var $email = '1919@gmail.com';
  $.ajax({
    type: 'POST',
    url: `https://a.klaviyo.com/api/v2/people/search?api_key=pk_d3af8ba75d110725231123ba795f05ffe77fb&email=${$email}`,
    success: function(res){
      console.log(res);
    }
  });
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The access control header has to be put on the server, not on the client. If you don't control the server, there's nothing you can do about this.

about 4 years ago · Juan Pablo Isaza Relatório

0

Putting you private key in a browser is a terrible idea. It allows ANY visitor to your website to then be able to access all of your admin API.

Klaviyo explicitly does not support CORS on the API requests for exactly this reason. See Klaviyo's response to a similar question here. https://community.klaviyo.com/apis-40/does-klaviyo-api-support-cors-requests-704?postid=2253#post2253

The correct way to do this is to have a server that you control make the requests to Klaviyo's api. You can make requests to your server from the JS.

about 4 years ago · Juan Pablo Isaza Relatório
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