--login / --logout / --whoami flag form is still accepted as an alias for back-compat.
Authentication is opt-in. Policies, the dashboard, the /audit page, and every other local feature work exactly the same whether you’re signed in or not. The login surface exists so that features that need a stable identity (re-audit reminders today, more in the future) have somewhere to anchor.
Sign-in flow
~/.failproofai/auth.json (mode 0600). The same session is then visible to the in-app dashboard — clicking [ set a reminder ] on /audit will see you as signed in.
The dashboard exposes the same flow as a modal dialog on /audit for users who never touch the CLI.
Sign-out
~/.failproofai/auth.json. If the api-server is unreachable, the local file is removed regardless — local intent to log out always wins.
Identity check
<email> (<user uuid>) and exits 0 when a valid session exists, or not signed in and exits 1 otherwise. Silently refreshes the access token in the background if it’s within a minute of expiring.
Persistent re-audit reminder
When you click[ set a reminder ] on the /audit page (or sign in via the modal that the button gates on), the dashboard writes a small companion file at ~/.failproofai/next-audit.json:
0600 perms like auth.json.
The dashboard’s /api/auth/reminder endpoint exposes GET (read), POST (set / reschedule), and DELETE (clear) and requires an active session.
What’s in ~/.failproofai/auth.json
0600 perms (owner-only read/write). The access token is a 1-hour HS256 JWT; the refresh token is an opaque 256-bit random string that the server stores as SHA-256(token). Refresh-token replay is detected server-side and revokes every session for the user.
Environment variables
| Variable | Default | Purpose |
|---|---|---|
FAILPROOF_API_URL | https://api.befailproof.ai | Override the api-server base URL. Useful for local development against a self-hosted api-server. |
FAILPROOFAI_AUTH_DIR | ~/.failproofai | Override where auth.json is stored. Mostly for tests. |
Troubleshooting
“Could not reach the api-server” — the CLI can’t open a TCP connection toFAILPROOF_API_URL. Check your network, or set FAILPROOF_API_URL if you’re running a self-hosted api-server.
“Rate limited” — too many login attempts in a 15-minute window for that email (5/email) or IP (20/IP), or a 30-second resend cooldown after the previous request for the same email. The error message includes the retry-after window in seconds.
Code rejected — the OTP was wrong, expired, or the row hit its 5-wrong-guess lockout. Run failproofai auth login again to request a fresh code.
