Access to XMLHttpRequest at 'https://api-v3.igdb.com/games' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://api-v3.igdb.com/games net::ERR_FAILED
uncaught (in promise) Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:83)
import React from "react";
import axios from "axios";
class GamesList extends React.Component {
componentDidMount = async () => {
// As mention in the docs, I'm using POST with the necessary body
axios.post("https://api-v3.igdb.com/headers", {
body: {
api_header: {
header: "Access-Control-Allow-Origin",
value: "*",
// now to make the actual request
const response = await axios.get("https://api-v3.igdb.com/games", {
headers: {
"user-key": "<API-KEY>",
"Access-Control-Allow-Origin": "http://localhost:3000",
console.log(response);
render() {
return <div>MANY GAMES</div>;
export default GamesList;
即使在postman内部将以下内容发布到
https://api-v3.igdb.com/headers/
,也会返回
Not found