Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

535
Vistas
Getting CORS Error when using fetch to get data

I am trying to access the API to get some data however i keep getting this CORS error. I have checked my code for any syntax errors but i can't find any. I have attached a picture of the error and my function which is supposed to get the data.

CORS Error

async function getData(){
  const request = await fetch('https://api.igdb.com/v4/games', {
    method: 'POST',
    headers: {
    'Client-ID': 'jglmao8u28qo1p9wltqne325i7xh3u',
    'Authorization': 'Bearer 4xau27m6liukizor4z2l8mlb7vbpjk',
  }
  })
  const response = await request.json();
  console.log(response);
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is a great proxy out there used just for this - bypassing a CORS block. The source code is here: https://github.com/Rob--W/cors-anywhere, and you would use it like this:

https://cors-anywhere.herokuapp.com/https://api.igdb.com/v4/games basically just adding the CORS-Anywhere URL before your actual image URL.

In your situation, it would be

async function getData(){
  const request = await fetch('https://cors-anywhere.herokuapp.com/https://api.igdb.com/v4/games', {
    method: 'POST',
    headers: {
    'Client-ID': 'jglmao8u28qo1p9wltqne325i7xh3u',
    'Authorization': 'Bearer 4xau27m6liukizor4z2l8mlb7vbpjk',
  }
  })
  const response = await request.json();
  console.log(response);
}

If you get rate limited by that website, try https://circumvent-cors.herokuapp.com/, this is one that I have deployed from the GitHub source code, no modifications and I do not think it should rate limit you.

Cheers, and let me know if this works.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda