getHistoricalData: Always getting Error 'Invalid token' for every token including 256265

dearsatya
const { KiteConnect } = require("kiteconnect");
const fs = require("fs");

const kc = new KiteConnect({
api_key: 'xyz',
});

kc.setAccessToken('RXLPoCPLly0Qle3wbKx1g7YT0uygwItz');

async function fetchHistoricalData() {
try {
const data = await kc.getHistoricalData({
instrument_token: '256265',
interval: 'minute',
from_date: "2024-09-18 09:15:00",
to_date: "2024-09-19 15:30:00",
continuous: false,
oi: false,
});
// const instr = await kc.getInstruments('NSE');
console.log("Historical Data: ", data);

} catch (error) {
console.error("Error fetching historical data: ", error);
}
}

Output:

Error fetching historical data: {
status: 'error',
message: 'invalid token',
data: null,
error_type: 'InputException'
}
This discussion has been closed.