Signing in with the CLI
branchd auth login, scoped logins with --repo, --group, --scopes and --wait, and branchd auth token.
Your everyday login
branchd auth loginThis signs you in with Xeonr Auth's device-code flow: open the printed
URL, confirm the code, and the sign-in is stored in your OS keychain (or a
0600 file under ~/.config/branchd). The CLI refreshes it silently, and
branchd auth setup-git and branchd registry setup-docker let git and
Docker use it too. --no-browser prints the URL without opening a
browser. That is also what happens when there is no terminal.
To use the current token from a script:
curl -H "Authorization: Bearer $(branchd auth token)" https://branchd.run/…Scoped logins
A scoped login asks for less than your everyday one. It is a separate
login, named with --profile, so your default login is untouched:
# A login that can read one repository: clone it, pull its images, read its pull requests
branchd auth login --profile api --repo acme/api
branchd --profile api repo list acme
# The same, but only for cloning and pulling images
branchd auth login --profile api-pull --repo acme/api --scopes forge:contents:read,forge:package:read| Flag | Meaning |
|---|---|
--profile NAME | Required. The name of this login. Use it with --profile on any command. |
--repo PATH | Limit the login to this repository. Repeat, or separate with commas. |
--group PATH | Limit the login to this group and everything under it. Repeat, or separate with commas. |
--scopes S,... | Ask for only these forge: scopes. Repeat, or separate with commas or spaces. |
--wait DURATION | How long to wait for the browser, for a link that will be opened later (e.g. 4h). Default 30m. |
Without --scopes, a scoped login asks for the Read level:
forge:repository:read forge:contents:read forge:release:read forge:package:read forge:pipeline:read forge:pull-request:read forge:review:read forge:check:read forge:branch-rule:read
(plus forge:group:read on a group). So it can clone and fetch, pull
images, and read releases, pipeline runs, pull requests, reviews, checks
and branch rules, on its repositories and groups only. Pass --scopes to
ask for less, or for write scopes such as forge:contents:edit.
forge:repository:read on its own reaches repository metadata and
settings, not git contents or images: cloning needs forge:contents:read
and pulling needs forge:package:read. branchd CLI releases before 0.50
asked only for forge:repository:read forge:pull-request:read forge:review:read forge:check:read by default, so a scoped login made with
one of them cannot clone; sign in again with a current CLI.
A scoped login signs in through the browser: it pushes its request to
Xeonr Auth (PAR) with each repository
and group as authorization_details and
branchd as the RFC 8707 resource. So it needs a browser that can reach
this machine's loopback address. On the consent screen you can narrow it
further (what the person grants).
Using a scoped login with git and Docker
branchd auth setup-git --profile api
branchd registry setup-docker --profile apiregistry setup-docker --profile api records the profile for
registry.branchd.run, so Docker's credential helper answers with that
login, and the registry then serves only its own repositories' images.