Standard Structure for Authenticated Requests
This is the culmination of the entire OAuth 1.0a / Diffie-Hellman handshake documented across the preceding five steps. Having derived and verified the Live Session Token (LST), this function represents the general-purpose authenticated request pattern used to call IBKR’s actual trading/portfolio API endpoints — in this example, /portfolio/accounts, though the function is written generically enough to serve any authenticated IBKR endpoint.
This marks a shift in signing methodology from every previous step: whereas the OAuth handshake steps (Request Token, Access Token, Live Session Token request) all signed requests using RSA-SHA256 with the application’s private key, all authenticated API calls going forward use HMAC-SHA256, keyed by the Live Session Token. This is the expected and correct behavior, and should be documented as the clear dividing line between the one-time handshake phase and the ongoing operational phase of the integration.
Prerequisites
Generic function design: Unlike the previous handshake steps, which were each dedicated to a single fixed endpoint, this function is parameterized by
methodandendpoint, making it the reusable core for all authenticated IBKR API traffic post-handshake. This should be documented as the primary, ongoing integration point that most consumers of this library will actually call — the handshake steps are a one-time (or infrequent) setup cost, while this function runs on every API interaction.
Construct the Request URL
Unlike the fixed OAuth endpoint URLs used in earlier steps, endpoint is caller-supplied, allowing this function to target any path on IBKR’s API gateway (e.g., /portfolio/accounts, /iserver/account/orders, etc.).
Assemble OAuth Parameters
This parameter set is notably leaner than every prior step — it omits oauth_callback and oauth_verifier (relevant only to the initial handshake) and, critically, declares oauth_signature_method as HMAC-SHA256 rather than RSA-SHA256.
Build the Signature Base String
Follows the same structural pattern as the Request Token and Access Token steps: sorted key=value pairs joined with &, then combined into METHOD&URL&PARAMS, with the URL encoded via quote_plus() and the parameter string via quote().
Query parameters excluded from signature base string: Note that
query_params(passed separately to the finalrequestscall in Step 6) are not included in this signature base string. Per OAuth 1.0a’s core specification, query string parameters that will be sent with the request are normally required to be included in the signature base string alongside the OAuth parameters.
Sign the Base String with HMAC-SHA256
The signature is computed as:
The resulting digest is Base64-encoded, then percent-encoded (quote_plus) for safe inclusion in the Authorization header — consistent with every prior signing step in this series.
This is the moment the LST is actually put to use. All prior documentation in this series has been building toward this single line:
live_session_token, once decoded from Base64 back into raw bytes, becomes the symmetric signing key for every authenticated request.

