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

542
Views
Obtener CORS Error al usar fetch para obtener datos

Estoy tratando de acceder a la API para obtener algunos datos, sin embargo, sigo recibiendo este error CORS. Revisé mi código en busca de errores de sintaxis, pero no puedo encontrar ninguno. He adjuntado una imagen del error y mi función que se supone que obtiene los datos.

Error CORS

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

0

Hay un gran proxy que se usa solo para esto: omitir un bloque CORS. El código fuente está aquí: https://github.com/Rob--W/cors-anywhere , y lo usaría así:

https://cors-anywhere.herokuapp.com/https://api.igdb.com/v4/games básicamente agregando la URL de CORS-Anywhere antes de la URL de la imagen real.

En tu situación, sería

 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); }

Si obtiene una tarifa limitada por ese sitio web, intente con https://circumvent-cors.herokuapp.com/ , esta es una que he implementado desde el código fuente de GitHub, sin modificaciones y no creo que deba limitar su tarifa.

Saludos, y avísame si esto funciona.

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!