Authentication failed

srismohanty
Hello Everyone.

I am new to this so can anyone please help me out a bit.

I am trying to connect to zerodha through kiteconnect but while doing so, after receiving the request_token when I try to $kite->generateSession("$request_token", "$apisecret");, I get the message "Authentication failed: Token is invalid or has expired." I don't understand, how can the token get expired in seconds after been received. Am I doing something wrong or need to do something else?

Can somebody help please?

Thank You
  • sujith
    Can you make sure you are using the new login URL as mentioned here?
  • sujith
    Can you private message your api_key? We will check and get back to you.
    You can also refer to this thread.
  • srismohanty
    srismohanty edited March 2018
    I am even getting the request_token like this

    xxxsettings.php?status=success&request_token=CeZkh4cb3Bb4oLMIt3Om8rdIDf3Acj0u

    But its the second phase where I use kiteconnect to get the access token through
    $user = $kite->generateSession("$request_token", "$api_secret");

    I am getting the error

    Authentication failed: Token is invalid or has expired.
  • sujith
    You need to send api_secret and not access token to generate a session.
  • srismohanty
    Sorry It was a mis-type on my part in this forum but I am actually using $api_secret not $access_token. I even tried a request from localhost but I still get the same error on my redirect url
  • ravis1234
    I am actually try api_secret_key but even getting same problem, can u please explain here..!
    Thanks
  • sujith
    A request token is valid for a couple of minutes and can be used only once.
    You can know more here.
Sign In or Register to comment.