I'm trying to access an API with a token, and I need to pass in X-Auth-Token in the header with the value being my token but I keep getting a CORS error
import axios from 'axios';
import React, { useEffect } from 'react';
function LeagueTable() {
const api = 'https://api.football-data.org/v4/teams/19';
axios.get(api, {
headers: {
'X-Auth-Token': '****',
},
});
return (
<div>
</div>
);
}
export default LeagueTable;
The error is: 'No 'Access-Control-Allow-Origin' header is present on the requested resource.' and an uncaught promise - can anyone advise?
I've tried playing around with how I enter the header as a parameter but to no avail - however on POSTMAN, I can pass in X-Auth-Token with the token in the header and it returns fine