# How to Create OAuth Credentials for GitLab

This guide will help you set up your GitLab OAuth app to connect with Apideck. GitLab is a complete DevOps platform that enables you to manage projects, issues, groups, and other resources through the GitLab API.

To create a connection with GitLab, you need to complete the following steps:

1. Enable the GitLab connector in Apideck
2. Create OAuth application in GitLab
3. Find your Group ID
4. Configure connector in Apideck
5. Test the connection

## Prerequisites

Before you begin, make sure you have the following:

1. A GitLab.com account - You can [sign up here](https://gitlab.com/users/sign_up)
2. An Apideck account
3. Access to a GitLab group (you'll need the Group ID for configuration)

## 1. Enable the GitLab connector in Apideck

First, enable the GitLab connector in your Apideck dashboard:

* Go to your Apideck dashboard
* Navigate to **Configuration > Issue Tracking > GitLab**
* The connector will be available for configuration

## 2. Create OAuth application in GitLab

### Login to GitLab

* Go to [GitLab.com](https://gitlab.com)
* Sign in with your GitLab account credentials

### Navigate to Applications

* After logging in, click your **profile picture** at the top right corner of the page
* Select **"Preferences"** from the dropdown menu

![GitLab Profile Menu](https://res.cloudinary.com/apideck/image/upload/v1768810706/docs/connectors/gitlab-server/gitlab-preferences.png)

* In the left sidebar, scroll down and click on **"Applications"**

![GitLab Applications Menu](https://res.cloudinary.com/apideck/image/upload/v1768812647/docs/connectors/gitlab/gitlab-create-application.png)

### Configure Application Details

Fill out the application information:

* **Name**: Enter a meaningful name for your application (e.g., "Apideck Integration")
* **Redirect URI**: Enter `https://unify.apideck.com/vault/callback`
* **Scopes**: Select the scopes you need. For full API access, select:
  * `api` - Access the authenticated user's API
  * `read_user` - Read the authenticated user's personal information
  * `read_api` - Read-only access to the API

![GitLab Create Application](https://res.cloudinary.com/apideck/image/upload/v1768812648/docs/connectors/gitlab/gitlab-setup-application.png)

* Click **"Save application"** to create the OAuth application

### Copy OAuth Credentials

After creating your application, GitLab will display the following credentials:

* **Application ID** (Client ID) - This is your OAuth Client ID
* **Secret** (Client Secret) - This is your OAuth Client Secret

![GitLab Application Credentials](https://res.cloudinary.com/apideck/image/upload/v1768812647/docs/connectors/gitlab/gitlab-copy-credentials.png)

**💡 TIP**: Copy the "Application ID" and "Secret". The secret will only be shown once and cannot be retrieved later.


## 3. Find your Group ID

You'll need to provide a Group ID when configuring the connector. The Group ID can be either a numeric identifier or the group's path/name. GitLab accepts both formats.

### Method 1: From the Group Page (Recommended)

* Navigate to your GitLab group by clicking on it from the dashboard or groups list
* Look at the URL in your browser's address bar
* The Group ID may appear in the URL, or you can find it by:
  * Clicking the **Actions menu** (three dots or ellipsis icon) in the upper-right corner of the group page
  * Selecting **"Copy Group ID"** if available in your GitLab version

![GitLab Group Actions](https://res.cloudinary.com/apideck/image/upload/v1768811414/docs/connectors/gitlab-server/gitlab-group-details.png)

### Method 2: From the Group URL

You can find the group identifier directly in the URL:

* If you see a URL like: `https://gitlab.com/groups/my-group-name` - you can use `my-group-name` as the Group ID
* Or: `https://gitlab.com/-/g/123` (where `123` is the numeric Group ID) - you can use `123` as the Group ID

![GitLab Group Actions](https://res.cloudinary.com/apideck/image/upload/v1768810644/docs/connectors/gitlab-server/gitlab-group.png)

**💡 TIP**: GitLab accepts both the numeric ID (e.g., `122352741`) and the group path/name (e.g., `Apideck-group`) as valid Group ID values.

## 4. Configure connector in Apideck

Now that you've successfully created your GitLab OAuth app and found your Group ID, you can add the credentials in the Apideck connector configuration.

### Add OAuth Credentials

* Go to your Apideck dashboard at [https://platform.apideck.com/](https://platform.apideck.com/)
* Navigate to **Configuration > Issue Tracking > GitLab**
* Select **"Use your GitLab client credentials"** and enter:
  * **Client ID**: Paste the **Application ID** you copied from GitLab
  * **Client Secret**: Paste the **Secret** you copied from GitLab

![Apideck GitLab Configuration](https://res.cloudinary.com/apideck/image/upload/v1768812648/docs/connectors/gitlab/apideck-configure-connector.png)


## 5. Test the connection

You can test your GitLab connector by clicking **Test Vault** in the Apideck dashboard.

* Click **Test Vault** to trigger the OAuth flow
* Click **Authorize** to grant access to your GitLab account

![Apideck Test Vault](https://res.cloudinary.com/apideck/image/upload/v1768812648/docs/connectors/gitlab/apideck-authorize-vault.png)

* Enter your **Group ID** or group name (can be numeric like `122352741` or the group path/name like `Apideck-group`)
* Click **Save** to save your configuration
* Your integration will now show as **Connected**

![Apideck Connected](https://res.cloudinary.com/apideck/image/upload/v1768812648/docs/connectors/gitlab/apideck-vault-authorized.png)

## Do your first API call to the Issue Tracking API

Test with this call:

```bash
curl --location 'https://unify.apideck.com/issue-tracking/collections' \
  --header 'x-apideck-consumer-id: test-consumer' \
  --header 'x-apideck-app-id: {APIDECK_APP_ID}' \
  --header 'x-apideck-service-id: gitlab' \
  --header 'Authorization: Bearer {APIDECK_API_KEY}'
```

Your GitLab OAuth credentials are now configured and ready to use! 🎉

## Troubleshooting

### Error: Invalid redirect_uri

If you receive an error about an invalid redirect URI, ensure that:

- The redirect URI is exactly `https://unify.apideck.com/vault/callback` (case-sensitive)
- The redirect URI has been properly added to your application in GitLab's Applications settings

### Error: Group Not Found

If you receive an error about the group:

- Verify that the Group ID is correct (can be numeric like `122352741` or the group path/name like `Apideck-group`)
- Ensure you have access permissions to the specified group
- Check that the group exists and is accessible with your user account
- If using a group path/name, ensure it matches exactly (case-sensitive)

### Error: Insufficient scopes

If you're receiving permission errors, ensure that you've selected all the necessary scopes in your GitLab OAuth application:

- `api` - Required for full API access
- `read_user` - Required for user information
- `read_api` - Required for read-only API access

You may need to reauthorize the application with additional scopes.
