i am receiving ticks data as usual but when i am trying to place order receiving below error. but before 28-apr-2022 it was working fine. { status: 'error', message: 'Invalid `api_key` or `access_token`.', data: null, error_type: 'InputException' }
tried multiple time as mentioned above from 28-apr-2022 i am facing this issue ticks are coming correctly but issue is from order placing side. i am running my service from past 1 month now (generated token every day manually around 9AM) . on 27-apr-2022 API has to expire so i renewed it on 25-apr-2022 . right after one month its happning so i generated new api_key secret still no success @SRIJAN
i just use websockets for ticks and placeOrder API but just checked on getPositions is throwing same error just websockets ticks are working fine as of now. @SRIJAN
even if i restart service without changing access token then still websockets ticks working fine and i can see running sessions from my APP its showing my service active session.
can u tell how can i get debug logs ? i have passed debug: true key in kiteConnect? @SRIJAN
This can only happen if you don't use set access token method.
If you are using that,and still the error,I can't figure out the issue brother.
Only Sujith Sir, Rakesh Sir can help you.
apart from that
exchange: "NSE"
tradingsymbol: "SUNPHARMA"
transaction_type: "BUY"
quantity: 1
product: "MIS"
order_type: "MARKET"
validity: "DAY"
@SRIJAN
@SRIJAN
And,do you start websocket every day or it's continuous??
@SRIJAN
can u tell how can i get debug logs ?
i have passed debug: true key in kiteConnect?
@SRIJAN
request
{"url":"/portfolio/positions","method":"get","data":null,"headers":{"common":{"Accept":"application/json, text/plain, */*"},"delete":{},"get":{},"head":{},"post":{"Content-Type":"application/x-www-form-urlencoded"},"put":{"Content-Type":"application/x-www-form-urlencoded"},"patch":{"Content-Type":"application/x-www-form-urlencoded"},"X-Kite-Version":3,"User-Agent":"kiteconnectjs/3.2.1","Content-Type":"application/x-www-form-urlencoded"},"params":{},"baseURL":"https://api.kite.trade","transformRequest":[null],"transformResponse":[null],"timeout":7000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false}}
response
{status: 'error', message: 'Invalid api_key or access_token.', data: null, error_type: 'InputException'}
if this is not required please let me know how could i help in this please
@SRIJAN
If you are using that,and still the error,I can't figure out the issue brother.
Only Sujith Sir, Rakesh Sir can help you.
var ticker = new KiteTicker({
api_key: apiKey,
access_token: AccessToken,
});
ticker.autoReconnect(true, 10, 5);
ticker.connect();
ticker.on("ticks", TicksFunc);
ticker.on("connect", subscribe);
ticker.on("noreconnect", function () {
logger.error("noreconnect");
});
ticker.on("reconnecting", function (reconnect_interval, reconnections) {});
function subscribe() {
ticker.subscribe(uniqueStocks);
ticker.setMode(ticker.modeFull, uniqueStocks);
}
const options = {
api_key: apiKey,
debug: true,
};
const kc = new KiteConnect(options);
kc.setAccessToken(AccessToken);
then i use this kc to place order
@SRIJAN
and how and when can i connect to @sujith @rakeshr sir please help me .
const options = {
api_key: apiKey,
debug: true,
};
const kc = new KiteConnect(options);
kc.setAccessToken(AccessToken);
and get request response as below for placeOrder.
if u want to see getHolding debug logs then i have put in above messages.
request
{"url":"/orders/regular","method":"post","data":"exchange=NSE&tradingsymbol=SUNPHARMA&transaction_type=BUY&quantity=1&product=MIS&order_type=MARKET&validity=DAY&variety=regular","headers":{"common":{"Accept":"application/json, text/plain, */*"},"delete":{},"get":{},"head":{},"post":{"Content-Type":"application/x-www-form-urlencoded"},"put":{"Content-Type":"application/x-www-form-urlencoded"},"patch":{"Content-Type":"application/x-www-form-urlencoded"},"X-Kite-Version":3,"User-Agent":"kiteconnectjs/3.2.1","Content-Type":"application/x-www-form-urlencoded"},"params":null,"baseURL":"https://api.kite.trade","transformRequest":[null],"transformResponse":[null],"timeout":7000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false}}
response
{status: 'error', message: 'Invalid `api_key` or `access_token`.', data: null, error_type: 'InputException'}
if u wnt anything else please let me know
i doing this . how could i resolve this. or can u share some curls so i will setup that only and will not use kite connect
const options = {
api_key: apiKey,
debug: true,
};
const kc = new KiteConnect(options);
kc.setAccessToken(AccessToken);
@sujith
its just somehow AccessToken is comming null here . i know its a silly one wil take care in future . thanks again. just wasted weekend over it .