Token is invalid or has expired

mamoni000
I have activated my previously expired app.
I am trying to login through python code but getting below error in kite.generate_session:

Exception has occurred: TokenException
Token is invalid or has expired.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "POST /session/token HTTP/1.1" 403 None
  • mamoni000
    can anyone help me here?
  • mamoni000
    MY CODE:
    import logging
    from kiteconnect import KiteConnect

    logging.basicConfig(level=logging.DEBUG)

    kite = KiteConnect(api_key="my api key")
    print(kite.login_url())
    request_token_here = str(input())
    #manually copy the login_url() and paste it to browser and copy the request token and input as a request_token_here
    data = kite.generate_session("request_token_here", api_secret="my api secret")
    kite.set_access_token(data["access_token"])
  • mamoni000
    @sujith can you please check
  • sujith
    Can you private message the api_key? We will check and get back to you.
  • mamoni000
    done, please check the details
Sign In or Register to comment.