Unable to fetch auth-token

saket2095
I am using postman to post " api-key, request-token and checksum" & header as "X-Kite-Version:3" to https://api.kite.trade/session/token. But getting this response. Kindly help and thanks in advance.

{
"status": "error",
"message": "`api_key` should be minimum 6 characters in length.",
"data": null,
"error_type": "InputException"
}
  • sujith
    You need to make a form request and not json request.
  • rakeshr
    @saket2095
    You need to POST api_key,request_token and checksum as body response as urlencoded data.
  • saket2095
    any of the answer is not helping me out kindly provide php related solution
  • saket2095
    code is :
    <?php
    $request_token = $_GET['request_token'];
    $status = $_GET['status'];
    $action = $_GET['action'];
    $apikey = "xxxxxxxxxx";
    $apisecret = "XXXXXXXXXX";

    $hash = hash('sha256', $apikey.$request_token.$apisecret);
    $fields = array(
    'api_key' => $apikey,
    'request_token' => $request_token,
    'checksum' => $hash
    );

    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.kite.trade/session/token",
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => $fields,
    CURLOPT_HTTPHEADER => array(
    "X-Kite-Version: 3"
    ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    print_r($response);
    echo $err;
    ?>

    kindly help me to find where i am getting it wrong.
Sign In or Register to comment.