New app - token invalid or expired

girpen
I got the request token following the documented steps from browser. I used it to get access token by calling renewAccessToken.
I receive the following message in exception:

"Token is invalid or has expired." with code 403
  • sujith
    You need to use generateAccessToken and not renewAccessToken.
  • ragural
    ragural edited November 2019
    I having same problem. I created new app today and followed the documentation to create request token. I am getting request token on the browser. but when I run default program

    I used following for getting started sample. https://github.com/zerodhatech/pykiteconnect
    I am trying to generate my token from https://kite.trade/connect/login?v=3&api_key=xxx but it always says "
    kiteconnect.exceptions.TokenException: Token is invalid or has expired."

    Please help. here is my code

    request_token="XXXXXX"
    kite = KiteConnect(api_key=api_key)
    data = kite.generate_session(request_token, api_secret=api_secret)

    kite.print(data)
  • rakeshr
    @ragural
    Can you re-check that you are using correct api_secret as mentioned on kite connect dev page?
  • ragural
    hi @rakeshr

    Thanks for your response. I just rechked.. My api_key was wrong. Now it is working..

This discussion has been closed.