Unable to get request_access_token

sjha_kumar
Hi,
I am new to programming and trying to connect kite through python code. I have purchased api connect access. while trying to retrieve request_access_token but getting below error. Please help.

Code:
kite = KiteConnect(api_key=my_api_key)
AccessToken = kite.request_access_token(my_request_token, my_api_secret)

Error:
('Authentication failed', 'Invalid session credentials')
Traceback (most recent call last):
File "D:/Pycharm_Project/untitled1/TestCode.py", line 28, in
user = kite.request_access_token(request_token_here, api_secret)
File "C:\Program Files\Anaconda2\lib\site-packages\kiteconnect\__init__.py", line 235, in request_access_token
"checksum": checksum
File "C:\Program Files\Anaconda2\lib\site-packages\kiteconnect\__init__.py", line 467, in _post
return self._request(route, "POST", params)
File "C:\Program Files\Anaconda2\lib\site-packages\kiteconnect\__init__.py", line 554, in _request
raise(exp(data["message"], code=r.status_code))
kiteconnect.exceptions.TokenException: Invalid session credentials

Thanks in Advance.
  • sujith
    Hi @sjha_kumar,
    All Kite Connect API calls are authenticated using access token and it is valid for one day.
    To fetch access token, you need request token. Typically a request token is valid for a couple of minutes and it can be used only once.

    When you run the script for the first time fetch access token and store it, from next run it should use stored access token.
  • sjha_kumar
    Hi @Sujith,
    I have successfully created request token and try to generate access token but getting this error. I didn't able to create access token first time.
Sign In or Register to comment.