> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/10.4/instance-administration/authentication/bitbucket-cloud.md).

# Bitbucket Cloud

To allow users to log in with Bitbucket Cloud credentials, you need to use an OAuth consumer and set the authentication settings in SonarQube Server 10.4.

{% hint style="info" %}
**For AI agents:** You're in the SonarQube Server 10.4 documentation. For a list of all 10.4 pages, see the [SonarQube Server 10.4 page index](https://2155789048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL4urx4YsPFYDefLTrxao%2Fuploads%2FlBlJSWAzuhYo7WEorlJX%2Fsonarqube-server-10.4-llms.txt?alt=media). For the whole site, see the [page index](https://docs.sonarsource.com/llms.txt) or the [full text](https://docs.sonarsource.com/llms-full.txt). For another version, replace 10.4 in the URL with that version. The [latest version](https://docs.sonarsource.com/sonarqube-server/) has no version number in its URL.
{% endhint %}

To allow users to log in with Bitbucket Cloud credentials, you need to use an [OAuth consumer](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) and set the authentication settings in SonarQube Server. See the following sections for more on setting up authentication.

### Setting your OAuth consumer settings <a href="#setting-your-oauth-consumer-settings" id="setting-your-oauth-consumer-settings"></a>

{% hint style="warning" %}
Bitbucket Cloud has replaced OAuth consumers with OAuth clients, so these steps no longer match the Bitbucket Cloud interface. When you create the OAuth client, select the **Authorization code** grant type and enter `<Your SonarQube URL>/oauth2/callback/bitbucket` in **Callback URLs** on the **Authorization** tab, then set the permissions on the **Scopes** tab. In SonarQube Server, enter the **Client ID** and **Secret** of your OAuth client in **OAuth consumer key** and **OAuth consumer secret**.
{% endhint %}

Create your OAuth consumer in your Bitbucket Cloud workspace settings and specify the following:

* **Name**: The name of your OAuth consumer.
* **Callback URL:** Your SonarQube Server instance URL.
* **Permissions**:
  * **Account**: **Read** and **Email** access.
  * **Workspace membership**: **Read** access.

### Setting your authentication settings in SonarQube Server <a href="#setting-your-authentication-settings-in-sonarqube" id="setting-your-authentication-settings-in-sonarqube"></a>

To set your global authentication settings, navigate to **Administration > Configuration > General Settings > Authentication > Bitbucket Cloud Authentication** and update the following settings:

* **Enabled**: Set to true.
* **OAuth consumer key**: Enter the **Key** from your OAuth consumer page in Bitbucket.
* **OAuth consumer secret**: Enter the **Secret** from your OAuth consumer page in Bitbucket.
* **Allow users to sign up**: enable to allow new users to authenticate. When disabled, only existing users will be able to authenticate to the server.
* **Workspaces**: Only users from Bitbucket Workspaces that you add here will be able to authenticate in SonarQube Server. This is optional but *highly* recommended to ensure only the users you want to log in with Bitbucket credentials are able to.

{% hint style="warning" %}
If the allowed workspaces are not entered, any user with a BitBucket account can log in to the SonarQube Server instance (assuming **Allow users to sign up** is set to true).
{% endhint %}

### Bitbucket Cloud group synchronization <a href="#bitbucket-cloud-group-synchronization" id="bitbucket-cloud-group-synchronization"></a>

Group synchronization is not supported for Bitbucket.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/10.4/instance-administration/authentication/bitbucket-cloud.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
