Authenticating Taubyte CLI
When to use
- First-time
tausetup on a machine taureturnsGET -- \/me` failed with status: 401 Unauthorized`tau new projectortau importfails citing GitHub auth- Need to retrieve the GitHub token for direct HTTP calls (jobs API, repository registration)
Mental model
tau stores profiles in ~/tau.yaml. Each profile holds a GitHub token used to call both the cloud API and GitHub itself. There are two ways to get a token into a profile:
- Token-based login (preferred for automation): supply an existing GitHub PAT.
- Browser OAuth (
tau login --new): the CLI starts a local callback server, prints a URL, and you finish authorization in the browser.
Token-based login (preferred)
tau login <profile_name> --provider github --token <github_token> --set-default
<profile_name>: any local label (e.g. your username).<github_token>: a GitHub Personal Access Token with the scopes the cloud expects.--set-default: makes this profile the active one.
Verify:
tau --defaults --yes json current
Expect a non-error output that includes the cloud + profile.
Browser OAuth fallback (tau login --new)
Use this when no usable token exists yet (e.g. truly first-time setup):
tau login --new <profile_name> --provider github
What happens:
tauprints aconsole.taubyte.com/oauth/...URL.taustarts a local callback server onhttp://127.0.0.1:<port>.- User or ai must open/click that URL in a browser, authorize, and let the redirect complete back to
127.0.0.1. Until that happens, downstreamtau push/query/importwork will keep failing.
Caveats observed:
- In strict non-interactive environments this can fail with
cannot prompt: non-interactive mode. Run it interactively the first time. - If the flow ends with
no session provided, rerun the command and complete the browser redirect again. - OAuth can reset selection state; after a successful login, re-check
tau --defaults --yes json currentand re-select cloud/project if needed.
Recovering from /me 401
Symptom:
GET -- `/me` failed with status: 401 Unauthorized
Recovery options (in order of preference):
- Refresh the token in
~/tau.yamldirectly underprofiles.<name>.token, then re-login:tau login <profile_name> --provider github --token <new_token> --set-default - Re-run OAuth if no token is available:
tau login --new <profile_name> --provider github - Sanity-check:
tau --defaults --yes json current - Dream / Patrick jobs HTTP returning
401or a body like{"invalid Github token":...}uses the same token astau— refresh the GitHub PAT (steps 1–2) before spending time on inject or build logic (diagnosing-dream-builds).
Several Dream-side flows need the same GitHub token (jobs API, repository registration). Read it from ~/tau.yaml rather than pasting it into shell history:
TOKEN=$(awk '$1=="token:"{print $2; exit}' "$HOME/tau.yaml")
Use as Authorization: github $TOKEN in curl calls — see diagnosing-dream-builds and registering-dream-repositories.
~/tau.yaml shape (simplified):
profiles:
<name>:
provider: github
token: <token>
default: <name>
Preconditions for downstream tau commands
tau new project, tau import project, and several tau cloud queries call GET /me against GitHub. If auth is broken, all of them fail. Run tau --defaults --yes json current after any auth change before continuing.
Gotchas
- Token in shell history is a leak. Prefer loading from
~/tau.yaml(awksnippet above) when scripting. - Multiple profiles. Without
--set-default, a fresh login may not become the active profile; latertaucommands then use a stale one. - OAuth in non-TTY shells fails. If you must script, use token-based login.
/me 401cascades. A single bad token surfaces as an opaque error intau new project,tau import, and even sometau pushflows. Always check/mefirst.
Related skills
bootstrapping-taubyte-projects— needs auth before any project opselecting-taubyte-context— operates on the active profilediagnosing-dream-buildsandregistering-dream-repositories— consume the token viaawk