code: 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<String, Object> params = new HashMap<String, Object>();
          params.put("api_key", apiKey);
          params.put("request_token", requestToken);
          params.put("checksum", sha256hex);
  
          return  new User().parseResponse(new KiteRequestHandler(proxy).postRequest(routes.get("api.validate"), params, apiKey, accessToken));
      }
docs: Do the token exchange with the `request_token` obtained after the login flow,
  and retrieve the `access_token` required for all subsequent requests.
  @param requestToken received from login process.
  @param apiSecret which is unique for each aap.
  @return User is the user model which contains user and session details.
  @throws KiteException is thrown for all Kite trade related errors.
  @throws JSONException is thrown when there is exception while parsing response.
  @throws IOException is thrown when there is connection error.