Getting Token Exception while generating session

anil_dahiya
Hi, I am getting below exception while trying to generate the session with help of request token i got from login:

08-20 16:17:25.326 25160-25338/com.shubhlabh.trading D/OkHttp: {"status":"error","message":"Invalid `checksum`.","data":null,"error_type":"TokenException"}
08-20 16:17:25.327 25160-25338/com.shubhlabh.trading D/OkHttp: <-- END HTTP (92-byte body)
08-20 16:17:25.334 25160-25338/com.shubhlabh.trading I/System.out: session expired
08-20 16:20:40.771 25160-25165/com.shubhlabh.trading I/art: Do partial code cache collection, code=113KB, data=123KB
08-20 16:20:40.772 25160-25165/com.shubhlabh.trading I/art: After code cache collection, code=113KB, data=122KB
08-20 16:20:40.772 25160-25165/com.shubhlabh.trading I/art: Increasing code cache capacity to 512KB

08-20 16:20:45.739 25160-25338/com.shubhlabh.trading W/System.err: com.zerodhatech.kiteconnect.kitehttp.exceptions.TokenException
08-20 16:20:45.740 25160-25338/com.shubhlabh.trading W/System.err: at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:48)
08-20 16:20:45.740 25160-25338/com.shubhlabh.trading W/System.err: at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20)
08-20 16:20:45.741 25160-25338/com.shubhlabh.trading W/System.err: at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:85)
08-20 16:20:45.741 25160-25338/com.shubhlabh.trading W/System.err: at com.zerodhatech.kiteconnect.KiteConnect.generateSession(KiteConnect.java:180)

Can you please help in getting same resolved ?

Also, apart from sessionexpiry hook is there a way to check is session has expired ? If yes, how to regenerate the session if its expired ? I am getting same error even on re-performing login and getting a fresh request token , further using this latest to generate session.

Thanks,
Anil Dahiya
  • anil_dahiya
    Hi, Can anyone please help me out here ? I didn't expected such a support from Zerodha. It's just a starting phase of integration and issues are coming with no clue on how to resolve them. Hope to get a resolution sooner on this.
  • sujith
    As the error says you seem to be passing Invalid checksum which means either api_key or api_secret is wrong.
    I would suggest going through documentation and some webinar videos mentioned here just to know the complete flow and capabilities of Kite Connect APIs.
  • anil_dahiya
    I have correctly used the api_key as provided while I registered on the kite developer site. Even I was having a valid session generated for sometime. But all of a sudden it started giving same TokenExpired ..Every input going from App side is same just response received from Kite is different. Can you please look into if its API key specific issue ?
  • anil_dahiya
    @sujith Can you please check on backend if there is something wrong w.r.t to Api Key or just for my user id ? Because it was working for sometime initially but after sometime it is failing back to back with all the inputs i.e. Api Key same.
  • sujith
    A request token can only be used only once and it is valid only for a couple of minutes. You can check out this thread for more information.
Sign In or Register to comment.