Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!