getting error as \"status\":\"error\",\"message\":\"Token is invalid or has expired

rbt
Still i am getting this error

Unhandled rejection StatusCodeError: 403 - "{\"status\":\"error\",\"message\":\"Token is invalid or has expired.\",\"data\":null,\"error_type\":\"TokenExcepti
at new StatusCodeError (C:\vivekblocklyproject\node_modules\request-promise-core\lib\errors.js:32:15)
at C:\vivekblocklyproject\node_modules\request-promise-core\lib\plumbing.js:97:41
at tryCatcher (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromiseCtx (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:606:10)
at Async._drainQueue (C:\vivekblocklyproject\node_modules\request-promise\n

my code is :-
var KiteTicker = require("./views/scripts/kiteconnect").KiteTicker;
var ticker = new KiteTicker("**************", access_token);

ticker.connect();
ticker.on("ticks", onTicks);
ticker.on("connect", subscribe);

function subscribe() {
var items = [instrument_token];
ticker.subscribe(items);
ticker.setMode(ticker.modeFull, items);
}

function onTicks(ticks) {
//if (redirectpage == 'http://localhost:8383/chart') {
list.add(ticks[0]);
console.log(ticks[0]);
StartAPI();
//console.log(list.length);
blocks.sort(sortAscending);
io.emit('ticks', { blocks: blocks });
io.emit('ticker', { data: ticks[0] });
}

kindly help me thanks in advance
  • rbt
    no i am using accesstoken with api key and its correct api key.

    i am not using client id as the new document is suggesting to use access token.

    kindly make me clear weather to use client id or accesstoken @rakeshr
  • rakeshr
    @rbt You need to use access token, generated after login and api key.Are you sure, you are using correct access token?
  • rbt
    yes i am using the correct access_token @rakeshr
  • rbt
    kc.requestAccessToken(request_token, "**********************************")
    .then(function (res) {
    var access_token = res.data.access_token
    kc.setAccessToken(access_token);
    console.log(access_token);

    this is the access token i am using which is of 32 character @rakeshr
  • rbt
    kindly reply @rakeshr
  • rakeshr
    @rbt We have checked at our end, it's working fine.Can you paste here complete error log.
  • rbt
    Unhandled rejection StatusCodeError: 403 - "{\"status\":\"error\",\"message\":\"Token is invalid or has expired.\",\"data\":null,\"error_type\":\"TokenExcepti
    at new StatusCodeError (C:\vivekblocklyproject\node_modules\request-promise-core\lib\errors.js:32:15)
    at C:\vivekblocklyproject\node_modules\request-promise-core\lib\plumbing.js:97:41
    at tryCatcher (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromiseCtx (C:\vivekblocklyproject\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:606:10)
    at Async._drainQueue (C:\vivekblocklyproject\node_modules\request-promise\n

    @rakeshr
  • rakeshr
    Make sure, you are using latest Kite Connect Javascript client version.
    You can check version of kiteconnect JS client by npm list --depth=0, it should be [email protected], if not ,then try installing latest version by npm install kiteconnect@beta.
  • rbt
    same error ,before this i am using the latest latest Kite Connect Javascript client version 3
    and after reinstalling i am getting the same error @rakeshr
  • rbt
    Please reply any body.....
  • rbt
    Attaching you the screensort of kite connect api version @rakeshr
  • rbt
    can anyone figure out this issue pls
  • Vivek
    Were you able to access Kite Connect api's without any issue for the same access token?
  • rbt
    yes i am getting the historical data @vivek with same access token
Sign In or Register to comment.