Log in from the terminal
You work cases in your terminal, and the commands that record anything need to
know who you are. /fito-login connects your pi session to the Fito account you
already have. When the browser cannot reach your terminal,
/fito-login-by-device does the same with a short code.
This page assumes you have an account. If you do not, make one first — Create an account and sign in.
Before you begin
Section titled “Before you begin”- A pi session with the Fito package installed. It loads in any folder.
- For
/fito-login, a browser on the same machine that can calllocalhost. The login hands tokens back overlocalhost, so it cannot complete over SSH, in a VM, or in a browser that blocks the call. There, use/fito-login-by-device, which needs a browser anywhere. - A Fito server you can reach. By default the TUI uses the hosted Fito, at
https://fito.codes.
Log in
Section titled “Log in”-
In your pi session, run:
/fito-login -
Your browser opens on the Fito login page. If it does not open by itself, the terminal prints the URL to visit:
Opening your browser to log in to Fito…If it does not open, visit:https://fito.codes/auth/login?return_to=tui&port=54321&handoff_secret=… -
Sign in in the browser, with either email and password or Continue with GitHub. Both work; they reach the same account. If your browser asks whether the site may reach apps on your device, allow it: that is how the page reaches your terminal.
-
The browser confirms and tells you to go back:
You’re logged in Return to your terminal — the Fito CLI now has your credentials. You can close this tab.
-
The terminal prints the success line:
✓ Logged in. Credentials saved to ~/.fito/credentials-fito.codes (mode 0600).On Windows, the line names no mode:
✓ Logged in. Credentials saved to ~/.fito/credentials-fito.codes.
Confirm it worked: run any command that needs an account, such as
/fito-submit, and it no longer asks you to log in.
If the page says The Fito CLI is not logged in, your sign-in worked and the page could not reach your terminal. See Troubleshoot installation.
Log in with a code
Section titled “Log in with a code”/fito-login-by-device needs no localhost. You approve a short code on the
Fito website, in any browser, on this computer or another, and the terminal
then fetches its tokens from the Fito server.
-
In your pi session, run:
/fito-login-by-device -
The terminal prints the address, the code and a direct link, then waits:
Open https://fito.codes/device and confirm the code WDJB-MJHT.Or open this link: https://fito.codes/device?code=WDJB-MJHTThe code expires in 10 minutes. Waiting for your approval…It also tries to open the direct link in a browser. Over SSH nothing opens, and nothing fails.
-
Open the direct link in any browser. On another computer, you can open
https://fito.codes/deviceinstead, type the code, and click Continue. -
If you are not signed in, click Log in or Sign up. After you sign in, the page comes back to your code.
-
Check that the code on the page matches the code in your terminal, and click Approve. The page says The Fito CLI is logged in.
-
The terminal prints the same success line as
/fito-login:✓ Logged in. Credentials saved to ~/.fito/credentials-fito.codes (mode 0600).
The code lives ten minutes. If you do not approve it in time, the terminal
prints ✗ The code expired. Run /fito-login-by-device again. and stops. No
token passes through the browser: the terminal asks the server every five
seconds, and the server hands the tokens over once, after you approve.
How the handoff works
Section titled “How the handoff works”/fito-login starts a small web server on your own machine, on a port picked at
random, and tells the login page where to find it. When you finish signing in,
the page posts the tokens straight to that local server.
Three things keep that narrow:
- The server accepts one request, from one origin — the web origin the TUI was configured with.
- The URL carries a single-use secret, freshly generated for this login. The browser echoes it back, and a request without the matching secret is rejected before its body is even read.
- Nothing travels outside your machine. The tokens go from your browser to
localhostand no further.
Where your credentials live
Section titled “Where your credentials live”Each Fito you log in to has its own file, ~/.fito/credentials-<host>, where
<host> is the host of that Fito’s address, with a : written as -:
credentials-fito.codes for the hosted Fito, credentials-localhost-8000 for a
local install. Off Windows, a file has mode 0600, and its directory mode
0700 — readable by you and nobody else on the machine. Windows sets no such
mode: there, the access list of your user folder protects the files.
Your password is never written there. A file holds token metadata only, so a leaked copy expires on its own rather than handing over your account forever.
Refresh and log out
Section titled “Refresh and log out”Your access token is short-lived. Most of the time you never notice, because commands refresh it for you.
To refresh by hand:
/fito-auth-refreshIt exchanges the stored refresh token for a fresh pair and rewrites the
credentials file of the Fito you use. If you are not logged in, it says so and
exits non-zero — run /fito-login instead.
To log out:
/fito-logoutIt revokes the refresh token on the server and deletes the Fito’s
~/.fito/credentials-<host>. Your logins to other Fitos stay. It is safe to run
when you are already logged out; it simply succeeds.
Point the TUI at a different server
Section titled “Point the TUI at a different server”One environment variable, FITO_URL, moves both halves. When it is unset, the
TUI uses the hosted Fito, at https://fito.codes. Set it to the address of
another Fito, and the TUI opens the login page at that address and calls the
backend at the same address plus /api.
A local install of Fito serves both halves from http://localhost:8000. To use
one, set the variable in the shell you start pi from. On Linux and in WSL:
export FITO_URL=http://localhost:8000In PowerShell:
$env:FITO_URL = "http://localhost:8000"In cmd:
set FITO_URL=http://localhost:8000Each Fito keeps its own login, so log in once on each Fito you use. Back on a Fito you logged in to before, your login is still there.
What’s next
Section titled “What’s next”- Find a case to work on — pick one from the catalogue.
- Open and work a case — fork it, clone it, and get briefed.
- Your data and privacy — what the credentials file holds and what it does not.