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

271
Visualizações
Why is my JavaScript code receiving a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error?

I am trying to create an app that would get the live comments from one of my live videos on my FB page and would play a notification sound whenever someone comments. I'm quite new to APIs and I tried reading the Graph API documentation for live comments here: https://developers.facebook.com/docs/graph-api/server-sent-events/endpoints/live-comments

Here is a sample that was given to subscribe to the endpoint and get the live comments:

var source = new EventSource("https://streaming-graph.facebook.com/{live-video-id}/live_comments?access_token={access-token}&comment_rate=one_per_two_seconds&fields=from{name,id},message");
source.onmessage = function(event) {
  // Do something with event.message for example
};

My access token works fine. Checked it on the Access Token Debugger. The access token has the proper permissions based on the documentation on the live-comments endpoint link above.

I tried the code out and it seems like the API call is successful because it's returning a status code of 200, but I'm getting this particular error message enter image description here

I tried searching for what to do and I can't find anything that can help me on fixing this. I am completely lost. I hope someone can help me fix this or even just point me to the right direction.

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