login
Open a browser window to authenticate with Stockbit, unblocking all other tools. Ask the user first, then confirm and check status.
Instructions
Open a browser window so the user can sign in to Stockbit. Nothing else here works until they have.
ASK THE USER FIRST, then call with confirm: true. This opens a real, visible window on their machine; where the client supports elicitation they are also asked directly.
It returns in about a second, BEFORE the login finishes — a person takes minutes and every client has a tool-call timeout. Tell them to sign in in the window that opened, then call status to see whether it worked. Do not call this again while status says a login is in progress.
The captured token goes straight to the keychain (or the encrypted file store off macOS). It is never returned here and never shown to you.
If the browser is ALREADY signed in to Stockbit, it no longer waits fifteen minutes for a form that will never appear: it reads the credential out of the browser's own session and finishes in seconds, and if there is nothing usable there it signs that profile out and re-opens the login page. A credential read out of the browser that way is PROVEN against Stockbit before status calls it captured — nothing logged in, so its expiry says nothing about whether it works. That proof rotates the token, which stales the browser session the chartbit tools drive; a login that showed a real form is trusted without it.
switch_account: true is for signing in as a DIFFERENT account — it clears the browser's Stockbit session first and never reuses what was there. Ask the user before using it; it signs them out of Stockbit in that browser profile.
Refuses when STOCKBIT_NO_BROWSER is set (to anything but 0/false/no/off), and names the terminal command instead. It also refuses if a session is already stored, unless force: true (which switch_account implies).
This does NOT log in to the trading account: that needs a 6-digit PIN typed at the user's own terminal via stockbit-auth trading-login, and no tool here accepts a PIN.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Log in again even though a session is already stored. | |
| confirm | Yes | Must be true, and only after asking the user in words. | |
| reap_orphans | No | If the browser exits immediately because something already holds the saved profile, end those processes and retry once. For the case where a previous login left browser processes behind and every login since has failed to open a window. ASK THE USER FIRST. It cannot tell an abandoned process from a working one — a browser that is fine answers the debugging port it was started with, not the new one this checks — so it ends EVERY process holding that profile, including a chart window the chartbit tools left open and are still using. | |
| fresh_profile | No | Use a throwaway browser profile instead of the saved one — nothing carried over, so the user re-enters password and OTP. For a profile that is corrupt or held open by another process. To sign in as a different account, use switch_account instead. IT DOES NOT FIX THE CHART TOOLS: the throwaway profile is discarded, so the API session starts working while the saved profile the chartbit tools actually drive stays signed out — every chartbit tool keeps failing until a login runs WITHOUT this. Prefer reap_orphans for a profile merely held open. | |
| switch_account | No | Sign the current Stockbit account OUT of the browser profile first, then show a real login form. For logging in as someone else. Implies force. |