String url = kiteSdk.getLoginURL();

naveen278
once I got the URL I manually logged into to get the Token from the browser. Then I copied the Token into my code and tried to use it to create a session using below:-
kiteSdk.generateSession(REQ_TOKEN_VALUE, API_KEY);
Now I am getting TokenException.

Can you let me know how to resolve this? is the way I got the TokenKey correct?
  • SRIJAN
    SRIJAN edited June 2022
    A request token is valid only for a few minutes and can be used only once.

    Use fresh generated request token to retrieve access token ,and save it in your local database.
    Use this access token for signing subsequent requests.
    This access token is valid for a whole day .


    Also,you have to pass api_secret and not api_key with the request token in the generate session function .
  • naveen278
    How to get Freshly generated requested token?
  • SRIJAN
    SRIJAN edited June 2022
    The error is happening because you are using api_key in place of api_secret in generate_session.
  • naveen278
    how to get ?

    a) API secret
    b) how to get a freshly generated requested token?

    I have only API key and my user ID.
  • SRIJAN
    SRIJAN edited June 2022
    a) To use KiteConnect APIs,you have to make a KiteConnect App,after successful creation,you will get both api_key and secret.A Kite Publisher app is only a gateway to place orders.

    b)https://kite.trade/forum/discussion/11441/user-user-kitesdk-generatesession-request-token-your-apisecret#latest
Sign In or Register to comment.