I am sending an API request to: https://api.chart-img.com/v1/tradingview/advanced-chart?key={API_KEY}
It also requires a Bearer token in the header which is also included. When I send the call through Postman, I get the expected response. This is my request:
const API_KEY = "bbd46466-5c55-427b-aaa7-7a19b6ea7e07";
const API_URL = `https://api.chart-img.com/v1/tradingview/advanced-chart?key=${API_KEY}`;
const Header = {
Authorization: `Bearer ${API_KEY}`,
};
axios.get(API_URL, Header).then((res) => console.log(res));
But when I send the call from my code, I receive this error:
It is working fine on postman and not in my code, can I assume it is some sort of security issue like CORS? Any help in this will be appreciated. The link to the documentation is given:
const axios = require("axios")
const API_URL = `https://api.chart-img.com/v1/tradingview/advanced-chart?key=XXX`
axios.get(API_URL).then((res) => console.log(res));