CLI Authentication
Authenticate the bricks CLI with your Bluebricks account using browser-based login or long-lived tokens for CI/CD
Bricks CLI supports two authentication methods: interactive login for local development, and API key authentication for automation and CI/CD pipelines.
Interactive login
Bricks CLI uses a device authorization flow to authenticate. The CLI generates a one-time code, opens your browser, and waits for you to approve.
Install the Bricks CLI if you haven't already
Run
bricks loginYour browser opens automatically to the verification page with a pre-filled code. If the browser doesn't open, copy the URL and code from the terminal and open it manually.
Sign in and approve the CLI
The terminal confirms authentication:
✓ Logged in successfully as you@company.comYour token is saved to ~/.bricks/credentials.yaml.
Verify your authentication:
bricks whoamiTroubleshooting
API key authentication
For automation and CI/CD, use long-lived API tokens instead of interactive login. There are three ways to provide an API key:
CLI flag
Environment variable (recommended for CI/CD)
Configuration file
Add to ~/.bricks/environment.yaml:
See API Authentication for how to create and manage API keys.
Authentication priority
Bricks CLI checks authentication sources in this order:
CLI flag (
--api-key)Environment variable (
BRICKS_API_KEY)Configuration file (
~/.bricks/environment.yaml)JWT token from
bricks login(~/.bricks/credentials.yaml)
Logout
See also
Authenticate Using Long-Lived Tokens: embed tokens directly in the credentials file
API Authentication: create and manage API keys
Quick Start: end-to-end onboarding walkthrough
Last updated

