Compute the Live Session Token
This is the final computational step in the IBKR OAuth 1.0a / Diffie-Hellman handshake. Using the values gathered across the previous steps — the client’s private DH exponent (dh_random), the server’s public DH value (dh_response), and the decrypted Access Token Secret (prepend) — this step computes the shared Diffie-Hellman secret and uses it to derive the Live Session Token (LST) via HMAC-SHA1.
The resulting computed_lst is the credential that will be used to sign all subsequent authenticated IBKR API requests, replacing the RSA-signature-based authentication used in the OAuth handshake steps themselves.
Scope note: This document covers only the LST computation. A critical follow-up step of verifying
computed_lstagainst thelst_signaturevalue returned by IBKR is handled in the next step of documentation.
Convert the Prepend to Bytes
The prepend value — the hex-string representation of the decrypted Access Token Secret — is converted back into raw bytes. This will serve as the message input to the HMAC computation in Step 5, not as key material at this stage.
Apply Sign-Bit Padding
This step addresses a subtle but important cryptographic encoding concern: big-integer sign representation.
When K’s bit length is an exact multiple of 8 (i.e., it fills whole bytes with no leading zero bits), the most significant bit of the resulting byte string could be interpreted as a sign bit by systems that treat the byte string as a signed big-endian integer (e.g., certain BigInteger implementations in Java or elsewhere). To guarantee K is always unambiguously interpreted as a positive/unsigned value when converted to bytes, a leading null byte (0x00) is prepended whenever this edge case is detected.
Why this matters for interoperability: This padding step exists specifically to ensure the byte representation of
Kproduced here is byte-for-byte identical to what IBKR’s server computes on their end (which may use a different language/library with different big-integer-to-bytes conventions, such as Java’sBigInteger.toByteArray(), which always includes a sign bit). Any mismatch here — even a single stray or missing byte — will cause the subsequent HMAC computation to diverge silently, producing an LST that IBKR’s server will reject. This is a common source of hard-to-diagnose cross-implementation bugs in DH exchanges and deserves explicit callout in public documentation.
Compute the HMAC-SHA1 Hash
The Live Session Token is derived as an HMAC-SHA1 computation:
SHA usage distinction: This is notably the only point in the entire IBKR OAuth flow where SHA-1 is used, in contrast to SHA-256 used for all RSA signature operations in the Request Token, Access Token, and LST request steps.
Encode the Final Live Session Token
The raw HMAC digest bytes are Base64-encoded into a string. This computed_lst value is the final Live Session Token — the credential used going forward to sign authenticated API requests against IBKR’s trading endpoints (typically via HMAC-SHA1 request signing, distinct from the RSA-SHA256 signing used throughout the handshake itself).

