It looks like you're new here. If you want to get involved, click one of these buttons!
    console.log("zerodhaLogin - start");
    console.log("request_token = ");
    console.log(request_token);
    if (request_token == null) {
      console.log("Invalid request token");
      cb("Invalid request token");
    }
kc.generateSession(request_token, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")   // (32 digit app secret)
      .then(function (response) {
        console.log("KC::generateSession Response == ");
        console.log(response)
        init();
      })
      .catch(function (err) {
        console.log("Error in KC:generateSession : ERROR = ");   //// Always getting here with error 'Token is invalid or has expired'
        console.log(err);
        cb(null, err);
      }).finally(function (e) {
        // On finish
        console.log("KC:: --  finally: -- e == ");
        console.log(e)
      });
    function init() {
      // Fetch equity margins.
      // You can have other api calls here.
      kc.getMargins("equity")
        .then(function (response) {
          console.log("KC::Got Your margins: -- Response == ");
          console.log(response)
          // You got user's margin details.
          cb(null, "THANK YOU");
        }).catch(function (err) {
          // Something went wrong.
          console.log("KC:: --  ERROR in Getting Your margins: -- ERROR == ");
          console.log(err)
          cb(null, err);
        }).finally(function (e) {
          // On finish
          console.log("KC:: --  finally: -- e == ");
          console.log(e)
        });
    }
.......
I am using 3.0.0 version of kiteconnect .
Can you mention which Kite Connect client are you using and version number of the client library?
Can you take a look at this thread also?