I'm trying to get access_token using 'https://api.kite.trade/session/token' by passing request_token but get null response sometimes. the issue is not frequent, it is working fine sometimes but get issue without any error message which is very difficult to find the root cause
yes, it is within try but there also error is printed as null, request token is right same code is running, this scenario is comming rarely once in 2-3 request consecutively with same account and can't use anather code plz suggest the fix(if any) with in this only
Make sure to remove app and client specific tokens.
let url = 'https://api.kite.trade/session/token';
var post_data = querystring.stringify({
api_key : api_key,
'request_token': request_token,
'checksum': check_sum
});
return new Promise(function (resolve, reject) {
request.post({
headers: {'content-type' : 'application/x-www-form-urlencoded'},
url: url,
body: post_data
}, function(error, response, body){
if (!error && response.statusCode == 200) {
resolve(body);
} else {
console.log(error);
reject(error);
}
});
});
}
this is the function where I'm trying to get the access token and when try to console the error get the null value
Make sure, you are passing
request_token,check_sum,api_key
values properly.