Invalid Checksum

parmar_akshay
parmar_akshay edited January 2018 in API clients
What I am trying to do
import { configurationFile } from "../lib/config";
import { getEnv } from "../lib/env";
var KiteConnect = require("kiteconnect").KiteConnect;

var kc = new KiteConnect({
api_key: configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey
});

kc.generateSession("XUhsHTqWQ7pmYd9Q0Scjy5to4jUPdqvg", configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey)
.then(function(response) {
console.log(response)
})
.catch(function(err) {
console.log(err);
});



I am getting this response as an error last three days =
{
"status": "error",
"message": "Invalid `checksum`.",
"data": null,
"error_type": "TokenException"
}
  • sujith
    Hi,
    The generateSession method takes request_token and api_secret. You can check out examples here.
  • parmar_akshay
    same error we are getting @sujith
  • sujith
    The above code seems to be sending api_key. Are you sure you are sending api_secret?
  • parmar_akshay
    parmar_akshay edited January 2018
    @sujith this is my code that was my typo error

    I tried whatever suggest in official doc


    and I regenerate api_secret also again and put that in config file also
    but still same issue I am facing from long time that invalid checksum


    `import { configurationFile } from "../lib/config";
    import { getEnv } from "../lib/env";
    var KiteConnect = require("kiteconnect").KiteConnect;

    var kc = new KiteConnect({
    api_key: configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey
    });

    kc
    .generateSession(
    "XUhsHTqWQ7pmYd9Q0Scjy5to4jUPdqvg",
    configurationFile[getEnv("NODE_ENV")].kiteConnect.apiSsecret
    )
    .then(function(response) {
    console.log(response);
    })
    .catch(function(err) {
    console.log(err);
    });`
  • parmar_akshay
    @sujith that was typo error I was using apiSecret directly without taking from config file before posting I changed that ,, I generate api_secret again and use that also but still facing same issue that was invalid checksum long time please help me out

    you can check the new code I put new secret key in config file also but result is still same



    import { configurationFile } from "../lib/config";
    import { getEnv } from "../lib/env";
    var KiteConnect = require("kiteconnect").KiteConnect;

    var kc = new KiteConnect({
    api_key: configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey
    });

    kc
    .generateSession(
    "XUhsHTqWQ7pmYd9Q0Scjy5to4jUPdqvg",
    configurationFile[getEnv("NODE_ENV")].kiteConnect.apiSecret
    )
    .then(function(response) {
    console.log(response);
    })
    .catch(function(err) {
    console.log(err);
    });
  • Vivek
    @parmar_akshay Is this happening if you directly give api secret to generateSession function instead of getting from env?
Sign In or Register to comment.