Configuring Bitbucket with AppScan on Cloud
Detailed instructions for integrating Bitbucket with AppScan on Cloud.
Prerequisites
- An active Atlassian account (used across Jira and Bitbucket).
- Admin privileges in your Bitbucket Workspace to create OAuth consumers.
Set up a Bitbucket workspace and repository
- Log in to Bitbucket:
- At bitbucket.org, click Log in at the top right.
- Enter your Atlassian account credentials.
- If prompted, complete any two-step verification (2FA) configured on your account.
- Create a new workspace to organize your projects and repositories:
- Click your profile avatar at the top right.
- Select All workspaces or click Create workspace directly from the menu.
- Fill in the workspace details:
- Workspace name: Enter an identifiable name (for example, My Team Workspace or John Doe Projects).
- Workspace ID: This auto-generates based on your name and becomes part of your URL (for example, bitbucket.org/workspace-id/).
- Click Create.
- Create a new repository:
- Inside your workspace, click the + (Create) button in the left sidebar or global navigation bar.
- Select Repository.
- Complete the repository creation form:
- Project name: Select an existing project or create a new project container.
- Repository name: Enter your repository name (for example, my-first-repo).
- Access level: Check Private repository to restrict access.
- Include a README?: Select No if you have existing local code to push, or Yes to initialize a new README file.
- Click Create repository.
Create an OAuth consumer in Bitbucket
OAuth consumers (clients) are managed at the workspace level and enable secure
application interaction.
- Log in to Bitbucket Cloud and ensure you are in the target workspace.
- Click Settings (gear icon) in the top navigation bar.
- Select Workspace settings from the menu.
- In the left navigation menu under Apps and features, select OAuth consumers.
- Click Add consumer at the top of the page.
- Fill in the consumer form fields:
- Name: Give your application a clear name (for example, My Custom Integration App).
- Description: Describe the OAuth client's function. Optional.
- Supported grant types: Check both Authorization code and Client Credentials.
-
Callback URL: Your AppScan Presence-embedded web application
URL plus /signin-bitbucket. For example,
https://my-presence-host-fqdn/signin-bitbucket. - URL: Link to your application or organization website. Optional.
- This is a private consumer: Keep checked if your client application runs on a secure server capable of maintaining secret confidentiality.
- Under the Scope section, grant the minimum required scopes:
- Account: Read or Email
- Repositories: Read
- Workspace Membership: Read
- Projects: Read
- Pull requests: Read
- Pipeline: Read
-
Click Save.
- Under OAuth consumers, click on the consumer name to expand it and
record your credentials:
- Key: This represents your
client_id. -
Secret: Click to reveal your
client_secret.
- Key: This represents your
Generate an Atlassian API token
- Navigate to id.atlassian.com/manage-profile/security and log in with your Atlassian credentials.
- Under API Tokens, click Create API token with scopes.
- Configure the token settings:
- Token name: Enter a descriptive name for the integration token.
- Expiry duration: Choose an appropriate validity duration (for example, 30 days or 1 year).
- Application: Select Bitbucket.
- Scopes / Permissions: Select required access privileges (for example, read:repository:bitbucket).
- Click Create token.
- Copy the newly generated token value immediately and store it in a secure secret store; it cannot be retrieved again after closing the dialog box.
Integration configuration mapping
Map the retrieved credentials into your git_connect_settings.json file:
| JSON property key | Source credential field | Description |
|---|---|---|
| ClientId | Bitbucket OAuth Consumer Key | Unique identifier for the OAuth consumer client. |
| ClientSecret | Bitbucket OAuth Consumer Secret | Secret key generated for the OAuth consumer. |
| GitApiToken | Atlassian API Token | Scoped API token string created in Atlassian Security. |
| GitEmail | Atlassian Account Email | Email address associated with the primary Atlassian account. |