> 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.3/instance-administration/authentication/gitlab.md).

# GitLab

In SonarQube Server 10.3, you can delegate authentication to GitLab using a dedicated GitLab OAuth application.

{% hint style="info" %}
**For AI agents:** You're in the SonarQube Server 10.3 documentation. For a list of all 10.3 pages, see the [SonarQube Server 10.3 page index](https://353248219-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl622HnhaCz6xSuy6XTfl%2Fuploads%2FqlWPhmFHjpw7Xdej9zkF%2Fsonarqube-server-10.3-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.3 in the URL with that version. The [latest version](https://docs.sonarsource.com/sonarqube-server/) has no version number in its URL.
{% endhint %}

You can delegate authentication to GitLab using a dedicated GitLab OAuth application.

## Creating a GitLab OAuth app <a href="#creating-a-gitlab-oauth-app" id="creating-a-gitlab-oauth-app"></a>

You can find general instructions for creating a GitLab OAuth app [here](https://docs.gitlab.com/ee/integration/oauth_provider.html).

Specify the following settings in your OAuth app:

* **Name**: Your app’s name, such as SonarQube Server.
* **Redirect URL**: `<Your SonarQube URL>/oauth2/callback/gitlab`. For example, `https://sonarqube.mycompany.com/oauth2/callback/gitlab`.
* **Scopes**: Select **api** if you plan to enable group synchronization. Select **read\_user** if you only plan to delegate authentication.

After saving your application, GitLab takes you to the app’s page. Here you find your **Application ID** and **Secret**.

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

Open your SonarQube Server instance, and navigate to **Administration > Configuration > General Settings > Authentication > GitLab Authentication**. Set the following settings to finish setting up GitLab authentication:

* **Enabled**: Set to `true`.
* **Application ID**: The application ID is found on your GitLab app’s page.
* **Secret**: The secret is found on your GitLab app’s page.

On the login form, the new **Log in with GitLab** button allows users to connect with their GitLab accounts.

## GitLab group synchronization <a href="#gitlab-group-synchronization" id="gitlab-group-synchronization"></a>

To associate GitLab groups with existing SonarQube Server groups of the same name, enable **Synchronize user groups** by navigating to **Administration** > **Configuration** > **General Settings** > **Authentication** > **GitLab**.

![](https://353248219-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl622HnhaCz6xSuy6XTfl%2Fuploads%2Fgit-blob-8b8c6981aea02999304ddab7182ea15b31046609%2Fbf2ae6c31d2e28a3cb27dcc33f025ef2c372d33e.png?alt=media)

To synchronize a GitLab group or subgroup with a SonarQube Server group, name the SonarQube Server group with the full path of the GitLab group or subgroup URL. For example, with the following GitLab group setup:

* **GitLab group**: My Group
* **GitLab subgroup**: My Subgroup
* **GitLab subgroup URL**: `https://YourGitLabURL.com/my-group/my-subgroup`

You will name your SonarQube Server group `my-group` to synchronize it with your GitLab group and `my-group/my-subgroup` to synchronize it with your GitLab subgroup.

See the **Group synchronization** section on the [Overview](/sonarqube-server/10.3/instance-administration/authentication/overview.md) for more detail about this feature’s general behavior.

{% hint style="info" %}
When group synchronization is configured, the delegated authentication source becomes the only place to manage group membership, and the user’s groups are re-fetched with each login. It is not possible to use both manual group memberships and group synchronization (via your ALM integration) for the same user.
{% endhint %}


---

# 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.3/instance-administration/authentication/gitlab.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.
