Skip to content
Bitbucket app passwords are deprecated and cannot be created. Use API tokens instead. Create an API token.

Auth Commands

Manage authentication with Bitbucket.

Global options available on all auth commands: --json, --no-color.

Authenticate with Bitbucket using an API token.

Terminal window
bb auth login [options]
OptionDescription
-u, --username <username>Bitbucket username
-p, --password <password>Bitbucket API token
--jsonOutput as JSON
Terminal window
# Login with credentials via command line
bb auth login -u myuser -p your-api-token
# Login using environment variables
export BB_USERNAME=myuser
export BB_API_TOKEN=your-api-token
bb auth login
  1. You provide your Bitbucket username and API token
  2. The CLI stores the credentials securely in your config file
  3. The CLI verifies the credentials by fetching your user information
  4. If verification fails, credentials are not saved

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.


Log out of Bitbucket and remove stored credentials.

Terminal window
bb auth logout [options]
OptionDescription
--jsonOutput as JSON
Terminal window
bb auth logout

This command removes only your stored credentials (username and apiToken) from the config file. Other settings like defaultWorkspace, skipVersionCheck, and versionCheckInterval are preserved.


Show current authentication status and account information.

Terminal window
bb auth status [options]
OptionDescription
--jsonOutput as JSON
Terminal window
# Check authentication status
bb auth status
# Get status as JSON
bb auth status --json

When authenticated:

✓ Logged in to Bitbucket
Username: myuser
Display name: My Name
Account ID: 123456789

When not authenticated:

ℹ Not logged in
Run bb auth login to authenticate.

Print the current access token (base64 encoded credentials).

Terminal window
bb auth token [options]
OptionDescription
--jsonOutput as JSON
Terminal window
# Print the token
bb auth token
# Get token as JSON
bb auth token --json

This is useful for:

  • Debugging authentication issues
  • Using the token with other tools or scripts
  • Verifying token format