Regen Req Token each call : Request Token gets invalidated after each api response

diwakerkla
diwakerkla edited September 2020 in Java client
imported codebase java client(shared on your website), and added client id, scret key and generated request token by providing valid api key from https://kite.zerodha.com/connect/login?v=3&api_key=test, test is just for example, added valid api key to gen request token, and, added into test java code, however after any api call, program asks to regen the request token, i have not changed anything in java client code provided by you, just added client id, sceret key, and request token, and tried to place a order, after order place api, program invalidated the token and asked for new token, this is happening for each api call ,any suggestion ?
  • rakeshr
    @diwakerkla
    Have you followed the exact steps mentioned here to generate access_token?
  • diwakerkla
    diwakerkla edited September 2020
    @rakeshr : i have not changed any code base in java client, added only tokens (client id, scret key and generated request token)in test java code and tried with place order, it went on success, and then tried to modify or cancel order, however program asked new token. did couple of time, same response
  • diwakerkla
    @rakeshr : yes, the same Url
    Error comes post each api call is : Token is invalid or has expired. 403 com.zerodhatech.kiteconnect.kitehttp.exceptions.TokenException
  • diwakerkla
    @sujith : any suggestion
  • diwakerkla
    com.zerodhatech.kiteconnect.kitehttp.exceptions.TokenException
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:48)
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20)
    at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.deleteRequest(KiteRequestHandler.java:117)
    at com.zerodhatech.kiteconnect.KiteConnect.cancelOrder(KiteConnect.java:347)
    at kiteconnect.com.diwaker.ddhl.util.Examples.cancelOrder(Examples.java:261)
    at kiteconnect.com.ddhl.function.OrderManagementFunction.cancelOrder(OrderManagementFunction.java:42)
    at kiteconnect.com.ddhl.controller.OrderManagementController.main(OrderManagementController.java:18)
  • diwakerkla
    @sujith @rakeshr : does this mean that for each api call, a new access token is needed ?
  • rakeshr
    does this mean that for each api call, a new access token is needed ?
    No, you can re-use earlier generated access_token. Can have look to this thread.
Sign In or Register to comment.