{"status":"error","message":"Invalid `api_key` or `access_token`.","data":null,"error_type":"InputException"}% Could you please send me proper way of adding headers to above command?
How I can generate the access token? the webinar has not explained in proper manner. I have successfully generated the request token. Could you please help me in generating the access Token?
I tried with below scenario: curl https://api.kite.trade/session/token \ -H "X-Kite-Version: 3" \ -d "api_key=xxx" \ -d "request_token=yyy" \ -d "checksum=zzz"
I have below questions now: I got the Access Token from below code: User user = kiteConnect.generateSession("asasa", "asasa"); kiteConnect.setAccessToken(user.accessToken); kiteConnect.setPublicToken(user.publicToken);
As per comments is stating that This access Token is valid valid for whole day right? But I have below observations: 1. KiteConnect kiteConnect = new KiteConnect("ssasasa"); kiteConnect.setUserId("XX3700"); String url = kiteConnect.getLoginURL();
kiteConnect.setSessionExpiryHook((SessionExpiryHook) new SessionExpiryHook() { @Override public void sessionExpired() { System.out.println("session expired"); } }); // Request Token, API Secret User user = kiteConnect.generateSession("sasa", "sasa"); kiteConnect.setAccessToken(user.accessToken); kiteConnect.setPublicToken(user.publicToken);
If we execute this code snippet the Java Process continues runs and never stopped.
2. Can we use this access token for full day trade activities in other session? 3. If we stopped the process at point 1, the Access token still valid? 4. If we logged out and from point 1, can we still use the stored access token for other API call?
@SRIJAN
Can you please have a look into this?
application/x-www-form-urlencoded
.https://kite.trade/docs/connect/v3/orders/
Even I have tried below command on Terminal:
curl --request POST https://api.kite.trade/orders/regular \
-H "X-Kite-Version: 3" \
-H "content-type: application/x-www-form-urlencoded" \
-H "Authorization: token sdsds:sdfsdf4fddffd454dfdfd" \
-d "tradingsymbol=BORORENEW" \
-d "exchange=NSE" \
-d "transaction_type=BUY" \
-d "order_type=LIMIT" \
-d "quantity=1" \
-d "product=CNC" \
-d "price=455" \
-d "validity=DAY"
I am getting the same error message:
{"status":"error","message":"Incorrect `api_key` or `access_token`.","data":null,"error_type":"TokenException"}%
You need to follow the login flow as mentioned in the documentation.
Could you please help me in generating the access Token?
I tried with below scenario:
curl https://api.kite.trade/session/token \
-H "X-Kite-Version: 3" \
-d "api_key=xxx" \
-d "request_token=yyy" \
-d "checksum=zzz"
Where Checksum - (SHA-256 of api_key + request_token + api_secret)
and request token generated from:
https://kite.zerodha.com/connect/login?v=3&api_key=dsddsd
Now when I am executing above command:
curl https://api.kite.trade/session/token \
-H "X-Kite-Version: 3" \
-d "api_key=xxx" \
-d "request_token=yyy" \
-d "checksum=zzz"
I am getting below error:
{"status":"error","message":"Token is invalid or has expired.","data":null,"error_type":"TokenException"}%
How I can proceed with the same?
Please send me your email.
I have below questions now:
I got the Access Token from below code:
User user = kiteConnect.generateSession("asasa", "asasa");
kiteConnect.setAccessToken(user.accessToken);
kiteConnect.setPublicToken(user.publicToken);
As per comments is stating that This access Token is valid valid for whole day right?
But I have below observations:
1.
KiteConnect kiteConnect = new KiteConnect("ssasasa");
kiteConnect.setUserId("XX3700");
String url = kiteConnect.getLoginURL();
kiteConnect.setSessionExpiryHook((SessionExpiryHook) new SessionExpiryHook() {
@Override
public void sessionExpired() {
System.out.println("session expired");
}
});
// Request Token, API Secret
User user = kiteConnect.generateSession("sasa", "sasa");
kiteConnect.setAccessToken(user.accessToken);
kiteConnect.setPublicToken(user.publicToken);
If we execute this code snippet the Java Process continues runs and never stopped.
2. Can we use this access token for full day trade activities in other session?
3. If we stopped the process at point 1, the Access token still valid?
4. If we logged out and from point 1, can we still use the stored access token for other API call?