Buildkite CLI auth command

The bk auth command allows you to manage authorization from the command line.

Commands

Command Description
bk auth login Login to Buildkite using OAuth or an API token
bk auth logout Logout and remove stored credentials
bk auth status Print the current user auth status
bk auth switch Switch to a different organization
bk auth token Print the stored API token for the current organization

Login auth

Login to Buildkite using OAuth or an API token

bk auth login [flags]

Flags

Flag Description
--debug Enable debug output for REST API calls
--org=STRING Organization slug (required with --token)
--scopes="" OAuth scopes to request
--token=STRING API token to store (non-OAuth login)

Examples

Login with full permissions (inherits your account's scopes):

bk auth login

Login non-interactively with an API token:

bk auth login --org my-org --token my-token

Login with read-only access:

bk auth login --scopes read_only

Login with read-only plus write access to builds:

bk auth login --scopes "read_only write_builds"

Login with specific scopes:

bk auth login --scopes "read_user read_organizations read_clusters write_clusters"

Logout auth

Logout and remove stored credentials

bk auth logout [flags]

Flags

Flag Description
--all Log out of all organizations
--debug Enable debug output for REST API calls
--org=STRING Organization slug (defaults to currently selected organization)

Status auth

Print the current user auth status

bk auth status [flags]

Flags

Flag Description
-o, --output="" Output format. One of: json, yaml, text
--debug Enable debug output for REST API calls
--json Output as JSON
--text Output as text
--yaml Output as YAML

Examples

List the current token session:

bk auth status

Switch auth

Switch to a different organization

bk auth switch [<organization-slug>]

Arguments

Argument Description
[<organization-slug>] Organization slug to switch

Flags

Flag Description
--debug Enable debug output for REST API calls

Examples

Switch the 'my-cool-org' configuration:

bk auth switch my-cool-org

Interactively select an organization:

bk auth switch

Token auth

Print the stored API token for the current organization

bk auth token

Flags

Flag Description
--debug Enable debug output for REST API calls

Examples

Print the current token:

bk auth token

Use the token in a curl request:

curl -H "Authorization: Bearer $(bk auth token)" https://api.buildkite.com/v2/user