How long a token lasts

An access token stays valid until the daily server restart (start of day) at about 4:00 AM IST. Logging in again issues a new token and the old one stops working. To renew, run the OAuth login again.

Lifetime

The login response includes expires_in. Treat it as an absolute Unix time, not a number of seconds. Compare it with the current time. Details: Token & session lifetime.

Checking a session

Call User Details at start-up. an HTTP error with an empty body, or stat: Not_Ok with a session message means: log in again.

Renewing

  1. Detect the failure (HTTP 403, or a Session Expired message).
  2. Stop sending orders.
  3. Run the OAuth login again to get a fresh token.
  4. Reconnect the WebSocket with the new token.

Ending a session

Call Logout when you are done, especially on shared machines.

Esc
↑↓ navigate↵ openEsc close/ to search