Invalid Access Token


APIs were working fine.

Historical data was giving "permission denied" error. So I subscribed to it. Logged out and Logged back in.

I then started getting invalid token error (Only for historical_data). I regenerated the secret.

But I still am getting 400 Access Denied for historical data. The exception is as below. Please help.

(venv) [email protected]:~/stocks$ python3 supertrend harsha "NSE:NIFTY 50"
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1):
DEBUG:urllib3.connectionpool: "GET /instruments/historical/NSE:NIFTY%2050/5%20minute?from=2022-04-29+09%3A15%3A00&to=2022-04-29+15%3A15%3A00&interval=5+minute&continuous=0&oi=0 HTTP/1.1" 400 86
Traceback (most recent call last):
File "/home/ubuntu/stocks/management/commands/", line 23, in __init__
File "/home/ubuntu/stocks/management/commands/", line 36, in get_ohlc
self.ohlcList = self.kite.historical_data(self.instrument, "2022-04-29 09:15:00","2022-04-29 15:15:00", "5 minute")
File "/home/ubuntu/venv/lib/python3.8/site-packages/kiteconnect/", line 622, in historical_data
data = self._get("market.historical",
File "/home/ubuntu/venv/lib/python3.8/site-packages/kiteconnect/", line 837, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
File "/home/ubuntu/venv/lib/python3.8/site-packages/kiteconnect/", line 913, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: invalid token

Sign In or Register to comment.