envshed login
Authenticate with Envshed.
Usage
envshed login [--token-stdin] [--api-url <url>]
Options
| Flag | Description |
|---|---|
--token-stdin | Read an existing API token from stdin, or from a masked prompt at a terminal |
-t, --token <token> | Deprecated. Login with an existing API token passed as an argument |
--api-url <url> | API URL (overrides config) |
Device authorization flow
Without --token, the CLI starts a device authorization flow:
- Opens your browser to the Envshed sign-in page
- Displays an 8-character code in the terminal
- Polls until you approve or deny in the browser
- Saves the token to the OS keychain, or to
~/.envshed/config.jsonwhere there is no keychain (details)
envshed login
Opening the browser is best effort. On a server or in a container with no browser, the URL and code stay on screen and the CLI keeps polling, so you can approve from another device.
If you're not already logged into Envshed in the browser, you'll be redirected to sign in first, then brought back to authorize the CLI.
The browser page shows the code and asks you to check that it matches the one in your terminal before Approve sign-in. Approve only if you just ran envshed login yourself: anyone who sends you a sign-in link would otherwise get a token for your account. If you didn't run it, or the code is different, press Deny. The CLI then stops with "Sign-in denied" and gets nothing.
If you open the page without a code in the link, type the code the CLI printed (lowercase and spaces are fine).
The CLI also stops early when the code expired or was already used ("This code is no longer valid") and when your account already has the most personal API tokens allowed. Revoke one in Account > Personal API tokens and run envshed login again.
The new token is named after your machine, for example CLI on gui-mbp (the hostname without its domain), so you can tell tokens apart in Account > Personal API tokens. It has no end date: it keeps working while it is used and stops after 30 days without a request.
The authorization times out after 10 minutes.
Token login
If you have an API token, you can skip the browser flow:
envshed login --token-stdin < token.txt
At a terminal, --token-stdin asks with a masked prompt instead. Either way, the token never appears on the command line.
--token <token> still works but is deprecated and prints a warning: other processes can read it from the command line, and it stays in your shell history.
Examples
# Interactive browser flow
envshed login
# Direct token login, from a secret manager
my-secret-tool read envshed-token | envshed login --token-stdin
# Login against a local dev server
envshed login --api-url http://localhost:3005
Login during setup
envshed init reuses this device authorization flow when a saved login is missing or expired, then resumes configuration. It does not treat access denial as an expired login or replace an explicit ENVSHED_TOKEN silently. Login failures return a nonzero exit status and stable, translated recovery messages.