Query on Request Token Best Practices for Node JS App

megharaj
megharaj edited May 2018 in API clients
Hi,

Recently I have integrated Kite API's in my nodeJS trading platform. I am facing one issue with the kite integration is, which i am not able to automate

In order to call the Kite API, we need to generate the access token from kite request token (right now, am doing manually)

Step 1 : Going into this URL - https://kite.trade/connect/login?api_key=XXXXXXXX
Step 2 : This will redirect to kite login page where i need to enter my kite credentials
Step 3 : After the successful authentication, it will redirect to my redirect URI with request token in the URL
Ex: http://localhost:3000/?request_token=XXXXXXXXXXXXXXXXXXXXXXX&action=login&status=success
Step 4: I am copying this in my nodejs configuration and starting the application

The request token validity time is very short. As per the kite documentation, am saving the access token and calling the kite API hence it works without any issue.

But the issue is, the access_token also invalidated in some cases so again the above steps which is necessary for kite integration.

So my query is,

Is it possible to automate the entire steps and when the session is invalidated (Kite provides the callback for reinitiating the session using setSessionExpiryHook)?

Thanks,
Megharaj

  • sujith
    It is mandatory by the exchange that a trader has to log in manually at least once a day. We don't recommend automating login.
    An access token generated will remain valid for the whole trading day. If your access token is invalidated during the day then check out this thread.
This discussion has been closed.