requestAccessToken fails with KiteTokenException

sachet_singh
I am running standalone command line program. basically, your sample code, with my keys. It does not connect. Can you pls help.

KiteConnect kiteconnect = new KiteConnect("");
kiteconnect.setUserId("");
String url = kiteconnect.getLoginUrl();
kiteconnect.registerHook(new SessionExpiryHook() {
@Override
public void sessionExpired() {
System.out.println("session expired");
}
});

// THIS LINE JUST FAILS
UserModel userModel = kiteconnect.requestAccessToken("request_token", "");

e.getMessage returns null
  • sujith
    Hi @sachet_singh,
    Request token you get is valid for only one time and the lifetime of a request token is a couple of minutes.
    The access token is valid for one day. Once you get access token store it and re-use it until your session is expired. Don't call
    requestAccessToken
    every time you run app.
  • sachet_singh
    but what is the request_token ? how do i retrieve it ? that call itself breaks
  • sachet_singh
    do we run this somewhere ?

    https://kite.trade/connect/login?api_key=xxx

    what exactly is the meaning of login flow ? i am just running your sample from command line. Sorry, but your samples/doc are not helping at all...
  • sachet_singh
    you can close this thread please. thank you.
This discussion has been closed.