Login not working for past 2 days

mailboxofrafiq
@sujith For past 2 days login in not working. I regenerated API secret also.. I am getting error:

session expired
Invalid checksum 403 com.rainmatter.kitehttp.exceptions.KiteTokenException
  • sujith
    Can you elaborate the process, how are you generating request token?
  • sujith
    Are you using Kite Connect 3?
  • mailboxofrafiq
    it was working fine for these many days
  • mailboxofrafiq
    @sujith

    This is how I implemented:

    1. Call this URL https://kite.trade/connect/login?api_key=myapikey
    2. This redirect to my url something.com
    3. I will get request token (This is working fine)
    4. Now I invoke below method I get access token & public token (Suddenly stopped working)

    public String login(String reqToken) {

    try {
    // First you should get request_token, public_token using kitconnect login and
    // then use request_token, public_token, api_secret to make any kiteConnect api
    // call.
    // Initialize KiteSdk with your apiKey.

    KiteConnect kiteConnect = new KiteConnect("myapisecret");

    // set userId
    kiteConnect.setUserId("myzerodhaid");

    // Set session expiry callback.
    kiteConnect.registerHook(new SessionExpiryHook() {
    @Override
    public void sessionExpired() {
    System.out.println("session expired");
    }
    });

    // Set request token and public token which are obtained from login process.
    UserModel userModel = kiteConnect.requestAccessToken(reqToken, "myapisecret");

    kiteConnect.setAccessToken(userModel.accessToken);
    kiteConnect.setAccessToken(userModel.publicToken);

    return "success";

    } catch (KiteException e) {
    System.out.println(e.message + " " + e.code + " " + e.getClass().getName());
    }
    return "";
    }
  • sujith
    You seem to be using old Kite Connect API. You are setting api_secret in place of api_key. You seem to be setting public token instead of the access token.
    Are you sure this was working earlier?
  • sujith
    sujith edited February 2018
    Check the examples inside sample directory of the javakiteconnect repository.
  • mailboxofrafiq
    mailboxofrafiq edited February 2018
    Ok resolved it.. in Kite 3.. requestAccessToken has been removed

    Please update the example given in this page. It is still showing old way of login using public token etc..

    https://github.com/zerodhatech/javakiteconnect/tree/kite3
  • sujith
    Example for generateSession is in the main file.
Sign In or Register to comment.