@jitendra I copy-pasted your code snippet and tested and it worked without any change. The only thing I did was insert my api_key, secret_key and remove the checksum line (as you don't need to compute the checksum yourself).
Please make sure you've copied the api_key and secret as-is (no extra spaces or characters).
Authentication failed: Invalid session credentials
Fatal error: Uncaught TokenException (403) 'Invalid session credentials' thrown in C:\xampp\htdocs\kiteconnect.php on line 586
Following are my code:
include 'kiteconnect.php';
//Hard coded values
$api_key = "xxxxxxxx";
$secret_key = "yyyyyyyyy";
// Incoming from the redirect.
$request_token = $_GET["request_token"];
echo "
Request Token is: ".$request_token;
$checksum = hash("sha256", $api_key . $request_token . $secret_key);
echo "
CheckSum is: ".$checksum;
$kite = new KiteConnect($api_key);
try {
$user = $kite->requestAccessToken($request_token, $secret_key);
echo "Authentication successful. \n";
print_r($user);
$kite->setAccessToken($user->access_token);
} catch(Exception $e) {
echo "Authentication failed: ".$e->getMessage();
throw $e;
}
echo $user->user_id." has logged in";
I have created KITE CONNECT + PUBLISHER app.
Please let me know what needs to be done.?
Please make sure you've copied the api_key and secret as-is (no extra spaces or characters).