Issue getting accessToken

manmohan3108
I got requestToken but after that the com.zerodhatech.kiteconnect client uses below code to get accessToken.

User user = kiteConnect.generateSession("xxxxxtttyyy", "xxxxxxxyyyyy");
kiteConnect.setAccessToken(user.accessToken);
kiteConnect.setPublicToken(user.publicToken);


But the code in kiteConnect.generateSession() is as below.

public User generateSession(String requestToken, String apiSecret) throws KiteException, JSONException, IOException {
// Create the checksum needed for authentication.
String hashableText = this.apiKey + requestToken + apiSecret;
String sha256hex = sha256Hex(hashableText);
// Create JSON params object needed to be sent to api.
Map params = new HashMap();
params.put("api_key", apiKey);
params.put("request_token", requestToken);
params.put("checksum", sha256hex);
return new User().parseResponse(kiteRequestHandler.postRequest(routes.get("api.validate"), params, apiKey, accessToken));
}



Here we can see the generateSession() method accessToken to post the request. Isn't it wrong to use accessToken to get accessToken.

Also why using routes.get("api.validate") while posting?

This discussion has been closed.