Hi! I have an issue while do js fetch request from website to Kommo CRM.
When I do this request I get a “CORS Error”, but in Postman this request return status 200, I think the issue in cross-origin.
This is my code:
const data = [
{
"name": "WEBSITE"
}
const response = await fetch('https://example.kommo.com/api/v4/leads', {
method: "POST",
headers: {
"Access-Control-Allow-Origin": "*",
"Authorization": "Bearer **access_token**",
"Content-Type": "application/json",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
"Access-Control-Allow-Credentials": true
},
credentials: 'same-origin',
body: JSON.stringify(data),
});
const json = await response.json();
console.log("Success:", JSON.stringify(json));
And screenshot of error in console
];
I will tell you more if you have any questions
Please, help me