Hi,
In a react component, I’m making an HTTP call after the component mounted:
componentDidMount() {
let apiEndPoint = 'https://paper-api.alpaca.markets/v1/last/stocks/AAPL';
let callOptions = {
'headers':{ 'APCA-API-KEY-ID': 'id...',
'APCA-API-SECRET-KEY':'key..'
}
};
let stockData = HTTP.call('GET', apiEndPoint, callOptions
, () => {console.log('getting stock data')})
}
However, I get the following error:
Access to XMLHttpRequest at 'https://paper-api.alpaca.markets/v1/last/stocks/AAPL' 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.
Does anybody maybe have an idea how can I fix that?
Thanks!