Auth Commands
Manage authentication with Bitbucket.
bb auth login
Authenticate with Bitbucket using an API token.
bb auth login [options]Options
| Option | Description |
|---|---|
-u, --username <username> | Bitbucket username |
-p, --password <password> | Bitbucket API token |
--json | Output as JSON |
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
- 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
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
Log out of Bitbucket and remove stored credentials.
bb auth logout [options]Options
| Option | Description |
|---|---|
--json | Output as JSON |
Examples
bb auth logoutWhat Gets Removed
This command removes your stored credentials (username and apiToken) from the config file. Other settings like workspace and repo are preserved.
bb auth status
Show current authentication status and account information.
bb auth status [options]Options
| Option | Description |
|---|---|
--json | Output as JSON |
Examples
# Check authentication statusbb auth status
# Get status as JSONbb auth status --jsonOutput
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
Print the current access token (base64 encoded credentials).
bb auth token [options]Options
| Option | Description |
|---|---|
--json | Output as JSON |
Examples
# Print the tokenbb auth token
# Get token as JSONbb auth token --jsonUse Cases
This is useful for:
- Debugging authentication issues
- Using the token with other tools or scripts
- Verifying token format