cli-login
One CLI login for every Anthus product, without long-lived keys.
- Sign in on this machine or from another device.
login --remoteprints a URL and a short matching code; you approve on your phone or laptop, and the waiting CLI receives its own renewable session. No access key, pasted code or token passes through chat. - Secure storage, never plain text. macOS Keychain, Linux Secret Service, the Linux kernel keyring, a memory-only agent for cloud machines, or Windows Credential Manager.
- Renewal and honest logout. Sessions renew with the refresh token. Logout revokes it, and says so when it could not.
- A broker per deployment. A small Lambda function and DynamoDB table that hands one authorization code to the one CLI that asked for it, and never holds a token.
Install
pip install cli-login
pip install "cli-login[linux]" # adds Secret Service support on Linux
Requires Python 3.10 or newer.
Where sessions are stored
Sessions live only in a secure store, tried in this order. There is no plaintext fallback: if nothing is usable, the tool fails with the exact steps to fix it.
| Platform | Store (in order) | Lasts |
|---|---|---|
| macOS | Keychain (service name = the product namespace, so existing sessions keep working) | until logout |
| Linux | 1. Secret Service (D-Bus), needs pip install "cli-login[linux]" and an unlocked keyring; 2. kernel keyring; 3. the memory agent |
keyring: until logout; kernel keyring: until reboot, or the persistent keyring's expiry (3 days from last use by default); agent: until it stops |
| Windows | Credential Manager (<namespace>/<key>; values over 2,560 bytes are chunked) |
until logout |
The memory agent is not available on Windows in this version. Set CLI_LOGIN_STORE to keychain,
secret-service, kernel-keyring, agent or credential-manager to choose a store explicitly (for operators
and tests). Any other value is refused.
Cloud machines and containers
A cloud machine usually has no desktop keyring, and Docker's default seccomp profile blocks the kernel keyring calls. Start the memory agent once per product, then sign in again:
python -m cli_login.stores.agent serve --namespace <product-namespace> --background
python -m cli_login.stores.agent status --namespace <product-namespace>
python -m cli_login.stores.agent stop --namespace <product-namespace>
A product mounts the same functions (stores.agent.serve, start_background, status, stop, main) under
its own CLI name, such as <product> auth agent. The agent holds sessions in memory only, behind a 0600 Unix
socket in a 0700 directory under the product's state directory (~/.config/cli-login/<namespace>/agent,
or the socket named by CLI_LOGIN_AGENT_SOCKET, which must sit in a private directory and be short
enough for a Unix socket). It checks the caller's user id on every connection, disables core dumps, and keeps
nothing on disk. After it stops, or the machine restarts, sign in again. Processes of the same user can use it,
as with ssh-agent.
Recovering from each failure
- "No Secret Service is reachable": no D-Bus session or keyring daemon. On a server, use the memory agent.
- "Secret Service keyring is locked": unlock it by signing in to the desktop session, then retry.
- "cli-login[linux]": the optional dependency is missing;
pip install "cli-login[linux]". - "kernel keyring is unavailable": the kernel or container blocks
add_key/keyctl. Use the memory agent, or run the container with a seccomp profile that allows them. - "The memory agent is not running": run the
servecommand shown in the message, then sign in again. - Agent socket refused: the directory or socket is not owned by you or not private; fix the mode (0700) or remove the stale path and restart the agent.
- "The stored session is damaged" (Windows): run the login command again to replace it.
- Credential Manager errors on Windows: sign in to Windows normally (not a restricted service account) and retry.
Status: see docs/design.md.
Releasing (maintainers)
Pushing to main (a pull request from develop) runs python-semantic-release on the conventional commits:
feat: and fix: (or a breaking change) bump the version in pyproject.toml, tag vX.Y.Z and create a GitHub
release; other commits release nothing. The pypi job then builds the sdist and wheel and publishes them with
OIDC trusted publishing, so no PyPI token is stored anywhere. Publishing needs a PyPI trusted publisher, registered
by the PyPI account owner: project cli-login, owner AnthusAI, repository cli-login, workflow
release.yml, environment pypi. The workflow's pypi environment must also exist in the repository settings.
The library targets Cognito user pools with the authorization-code flow and PKCE. Each product supplies its own issuer, client and endpoints; this repository holds none.
License
MIT
Metadata
Release files for cli-login 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cli_login-0.2.0.tar.gz | 106.5 kB | With provenance | Details for cli_login-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cli_login-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cli_login-0.2.0-py3-none-any.whl |
Total release size: 154.4 kB
Release files / cli_login-0.2.0.tar.gz
| Download URL | cli_login-0.2.0.tar.gz |
|---|---|
| Size | 106.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
280fda3e3ee49aa8fdc33f85946be8caebbcf43972414e9ed68e23694c3f3532
|
|
BLAKE2b-256 checksum How to use checksums |
30f846307023fc0dbbb2325f030f9565ac07196732ee5cf5b091639bc723978c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / cli_login-0.2.0-py3-none-any.whl
| Download URL | cli_login-0.2.0-py3-none-any.whl |
|---|---|
| Size | 47.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f768558b675a172d468138b144ba3bb50da9bcd2b02d4abc62e1b2a6699bd820
|
|
BLAKE2b-256 checksum How to use checksums |
b9276cd96e4033a6bcc294464cde2fb4a76c94a5c0faf203c2d6fad9faba2434
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for cli-login 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cli_login-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.