Javascript: "Third-party cookie will be blocked. Learn more in the Issues tab."

As a conequence the program stop working.
It seems that there is no way to get rid of the error message in the error.log window.
I tried three different versions of ajax Javascript:

  • fetch
  • app.HttpRequest
  • await fetch

each one with different code logic.

I understand other developers are experiencing the same problem, for instance:

My app pretends to access Openai APIs directly from Javascript (see code below).

How to avoid the restriction of third party cookies?
Anybody in this group is experiencing the same?

Example of code below:

async function openaiStartThreadCreation(text,openaiApiKey,assistantId) {
var url = ‘https://api.openai.com/v1/threads’;
const options = {
method: ‘POST’,
headers: {
‘Authorization’: 'Bearer ’ + openaiApiKey,
‘Content-Type’: ‘application/json’,
‘OpenAI-Beta’: ‘assistants=v1’
},
body: JSON.stringify({
messages: [{ role: ‘user’, content: text }]
})
}
try {
const response = await fetch(url, options);
const data = await response.json();
if ( isEmpty(data) ) {
app.Alert(t_norisp[lang],t_err[lang]);
}
openaiRunAssistant(data.id, assistantId, openaiApiKey);
} catch(e) {
console.error('Error: ', e);
app.Alert(t_norisp[lang],t_err[lang]);
}
}

1 Like

I’m experiencing the same issue in my React app, while trying to integrate Inteccome into my app. Is there a solution for it?

I need help with this website i am facing the same error message you help me

I have been able to circumvent the problem by managing tha API calls from a web server, calls through PHP, then calls from my application program go to my web server. The server acts as intermediary. It solves the cross-origin problem. It is not the solution I wanted, but I did not find a better one.