Unable to connect to KITE using node js Getting Token is invalid or has expired error

debchamps
debchamps edited June 2018 in Java client
I just acquired a kite developer account. I am trying to connect to kite using the code below.
downloaded kiteconnectjs from https://github.com/zerodhatech/kiteconnectjs
var KiteConnect = require("kiteconnect").KiteConnect;
var kc = new KiteConnect({
api_key: "api_key"
});

kc.generateSession("request_token", "api_secret")
.then(function(response) {
init();
})
.catch(function(err) {
console.log(err);
});

function init() {
kc.getMargins()
.then(function(response) {
})
.catch(function(err) {
});
}
However during generateSession call it is failing with the following exception
{ status: 'error',
message: 'Token is invalid or has expired.',
data: null,
error_type: 'TokenException' }
I am replacing api_key and api_secret with the corresponding key and secret of my app
Do we need to replace the "request_token" value passed in generateSession and if YES how do we generate the value.
Sign In or Register to comment.