TokenException: Token is invalid or has expired.

ranjan_barat
Hello Team,

I have generated the request token but login into the URL, allowing all the Permissions etc, but getting the following errors wile using the request token

kite.generate_session("wwww",api_secret="qqqq") in ()
----> 1 data = kite.generate_session("wwww",api_secret="qqqq")

/anaconda3/lib/python3.6/site-packages/kiteconnect-3.7.4-py3.6.egg/kiteconnect/connect.py in generate_session(self, request_token, api_secret)
230 "api_key": self.api_key,
231 "request_token": request_token,
--> 232 "checksum": checksum
233 })
234

/anaconda3/lib/python3.6/site-packages/kiteconnect-3.7.4-py3.6.egg/kiteconnect/connect.py in _post(self, route, params)
699 def _post(self, route, params=None):
700 """Alias for sending a POST request."""
--> 701 return self._request(route, "POST", params)
702
703 def _put(self, route, params=None):

/anaconda3/lib/python3.6/site-packages/kiteconnect-3.7.4-py3.6.egg/kiteconnect/connect.py in _request(self, route, method, parameters)
764 # native Kite errors
765 exp = getattr(ex, data["error_type"], ex.GeneralException)
--> 766 raise exp(data["message"], code=r.status_code)
767
768 return data["data"]

TokenException: Token is invalid or has expired.

Environment Used: Anaconda using jupyter notebook 5.6.0 , using kite connect from pykiteconnect
I have followed the documentation at https://kite.trade/docs/pykiteconnect/v3/ & the Webinar as well.

It would would be really helpful is anyone can assist on this issue.

====Complete Code====
import logging
from kiteconnect import KiteConnect
api_key = "qqqq"
api_secret = "qqqq"
logging.basicConfig(level=logging.DEBUG)
kite = KiteConnect(api_key="qqqq")
kite.login_url()
OUT ==> 'https://kite.trade/connect/login?api_key=qqqq&v=3'
data = kite.generate_session("request_token",api_secret="qqqq")


Regards
Sign In or Register to comment.