Getting Invalid Session ID Error after Successful obtaining request token on 07/01/2020

AnkurGoyal
Getting Invalid Session ID Error on generating access token after Successful obtaining request token, But same code working for me,a day before.
  • rakeshr
    @AnkurGoyal
    Can you re-check, if you are entering the correct request_token to generate access_token?
    Also, once request_token is used to generate an access token. Request token expires immediately after that. And it cannot be reused further, make sure you are not re-using the same.
  • AnkurGoyal
    I know that request token cann't be reused.
    But the same code was working a day before.
  • rakeshr
    @AnkurGoyal
    Can you paste your code here? We will look to it.
  • AnkurGoyal
    <?
    session_start();
    $apikey = 'xxxxxxxx';
    $secret = 'xxxxxxxx';
    include "kiteconnect.php";
    $kite = new KiteConnect($apikey);
    if (isset($_SESSION['Access'])) {
    $Access = $_SESSION['Access'];
    $kite->setAccessToken($Access);
    }else{
    if ( !isset($_GET['request_token']) ) {
    header("Location: https://kite.trade/connect/login?api_key=$apikey");
    die();
    }
    $request = $_GET['request_token'];
    try {
    $user = $kite->generateSession($request, $secret);
    $kite->setAccessToken($user->access_token);
    $Access = $user->access_token;
    $_SESSION['Access'] = $Access;
    } catch(Exception $e) {
    die($e);
    }
    }
    ?>
  • sujith
    Can you paste the complete stack trace here?
    This query is still not clear.
Sign In or Register to comment.