Auth Commands
Manage authentication with Bitbucket.
Global options available on all auth commands: --json, --no-color.
bb auth login
Section titled “bb auth login”Authenticate with Bitbucket using an API token.
bb auth login [options]Options
Section titled “Options”| Option | Description |
|---|---|
-u, --username <username> | Bitbucket username |
-p, --password <password> | Bitbucket API token |
--json | Output as JSON |
Examples
Section titled “Examples”# Login with credentials via command linebb auth login -u myuser -p your-api-token
# Login using environment variablesexport BB_USERNAME=myuserexport BB_API_TOKEN=your-api-tokenbb auth loginHow It Works
Section titled “How It Works”- You provide your Bitbucket username and API token
- The CLI stores the credentials securely in your config file
- The CLI verifies the credentials by fetching your user information
- If verification fails, credentials are not saved
Required Scopes
Section titled “Required Scopes”Your API token needs these scopes:
- Account: Read (to verify your identity)
- Repositories: Read, Write (depending on operations you’ll perform)
- Pull requests: Read, Write (for PR operations)
See the Authentication guide for detailed setup instructions.
bb auth logout
Section titled “bb auth logout”Log out of Bitbucket and remove stored credentials.
bb auth logout [options]Options
Section titled “Options”| Option | Description |
|---|---|
--json | Output as JSON |
Examples
Section titled “Examples”bb auth logoutWhat Gets Removed
Section titled “What Gets Removed”This command removes only your stored credentials (username and apiToken) from the config file. Other settings like defaultWorkspace, skipVersionCheck, and versionCheckInterval are preserved.
bb auth status
Section titled “bb auth status”Show current authentication status and account information.
bb auth status [options]Options
Section titled “Options”| Option | Description |
|---|---|
--json | Output as JSON |
Examples
Section titled “Examples”# Check authentication statusbb auth status
# Get status as JSONbb auth status --jsonOutput
Section titled “Output”When authenticated:
✓ Logged in to Bitbucket Username: myuser Display name: My Name Account ID: 123456789When not authenticated:
ℹ Not logged inRun bb auth login to authenticate.bb auth token
Section titled “bb auth token”Print the current access token (base64 encoded credentials).
bb auth token [options]Options
Section titled “Options”| Option | Description |
|---|---|
--json | Output as JSON |
Examples
Section titled “Examples”# Print the tokenbb auth token
# Get token as JSONbb auth token --jsonUse Cases
Section titled “Use Cases”This is useful for:
- Debugging authentication issues
- Using the token with other tools or scripts
- Verifying token format