I'm trying to get the access token with /session/token API and getting the following error: 403 Forbidden: [{"status":"error","message":"Invalid `checksum`.","data":null,"error_type":"TokenException"}]"
I'm aware of the Java Client but we're not planning to use it currently. I'm making a call directly to the /session/token API.
I'm generating checksum with HmacSHA256 in Java as follows: Mac sha256_HMAC = Mac.getInstance(Constants.HMAC_SHA_256); SecretKeySpec secret_key = new SecretKeySpec(apiSecret.getBytes(), Constants.HMAC_SHA_256); sha256_HMAC.init(secret_key); /* message = api_key + request_token + api_secret */ byte[] hash = sha256_HMAC.doFinal(message.getBytes()); String checksum = Hex.encodeHexString(hash);
I tried to figure out how java client is generating this checksum but couldn't find anything. Could you please help me figure out what am I doing wrong?
https://github.com/zerodha/javakiteconnect/blob/3a35d18b56275cffdfe4a55324c1abd75eae40ee/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L10
https://github.com/zerodha/javakiteconnect/blob/3a35d18b56275cffdfe4a55324c1abd75eae40ee/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L177