How to create Oauth2 credentials for GitLab

How to create Oauth2 credentials for GitLab

In this guide, I’ll share the process for creating OAuth2 credentials in GitLab and connecting them to Composio. Let’s get started

Setting up GitLab

GitLab allows you to create OAuth applications directly from your account settings. These apps give you the Client ID and Client Secret needed to connect securely.

NOTE: You’ll need a GitLab account. If you don’t have one, sign up for free at gitlab.com.

Step 1: Log in to GitLab

  1. Go to GitLab and sign in.

  2. In the top-right corner, click on your profile avatar.

  3. From the dropdown, select Edit profile.

Step 2: Navigate to Applications

In the left-hand sidebar, scroll down and click Applications.

(Direct link: https://gitlab.com/-/profile/applications)

This is where you can create and manage your OAuth apps.

Step 3: Create a New OAuth Application

Click on New Application.

Fill in the fields as follows:

  • Name → Example: Composio GitLab Integration

  • Redirect URI → Paste the Composio callback URL:

Make sure it’s exact (no trailing /).

  • Scopes → Select the following (depending on what you want Composio to access):

    • read_user (to read user profile info)

    • api (to access GitLab APIs)

    • read_api (if you want limited read-only access)

For testing, you can just tick read_user and api.

Scopes supported by Composio:

Below are all the scopes that Composio supports for GitLab. You should add these scopes based on your integration requirements:

These scopes define the permissions your app can request during the OAuth authorization process. It’s essential to select only the scopes necessary for your application's functionality, adhering to the principle of least privilege.

Note: The actual scopes you should request depend on your specific integration requirements.

For example, if your app needs to read and write repository data, you would include read_repository and write_repository in your OAuth configuration.

You can customize these scopes according to your integration needs.

Step 4: Save and Copy Credentials

  1. Click Save application.

  2. GitLab will now show you:

    • Application ID → This is your Client ID.

    • Secret → This is your Client Secret.

Copy the secret immediately, GitLab only shows it once!

Creating the Auth Config in Composio

With your GitLab OAuth credentials ready, let’s configure them inside Composio.

  1. Open the Composio Dashboard.

  2. Click on Create Auth Config.

  1. From the list of toolkits, select GitLab.

  2. Choose OAuth2 as the authentication type.

Step 5: Fill in Your OAuth Details

In the Manage Auth Config section:

  • Client ID → Paste your GitLab Application ID.

  • Client Secret → Paste your GitLab Secret.

  • Redirect URI → Must match exactly:

  • Base

  • Scopes → Add the same scopes you enabled when creating the app (read_user, api, etc.).

* the redirect URL is v3

Click Create Gitlab Auth Config.

Authorise and Connect

  1. Get the External User ID from GitLab in the profile section

  1. In Composio, click Connect Account in your GitLab Auth Config, then enter the User ID you just copied.

  1. The GitLab consent screen will open, displaying the requested permissions.

  2. Click Authorise.

Composio securely stores the access token upon success.

Base URL for GitLab

By default, use GitLab’s hosted API:

If you are using a self-hosted GitLab instance, replace the base URL with your instance’s API endpoint.

That’s it! You’ve now set up OAuth2 credentials for GitLab and connected it with Composio.

In this guide, I’ll share the process for creating OAuth2 credentials in GitLab and connecting them to Composio. Let’s get started

Setting up GitLab

GitLab allows you to create OAuth applications directly from your account settings. These apps give you the Client ID and Client Secret needed to connect securely.

NOTE: You’ll need a GitLab account. If you don’t have one, sign up for free at gitlab.com.

Step 1: Log in to GitLab

  1. Go to GitLab and sign in.

  2. In the top-right corner, click on your profile avatar.

  3. From the dropdown, select Edit profile.

Step 2: Navigate to Applications

In the left-hand sidebar, scroll down and click Applications.

(Direct link: https://gitlab.com/-/profile/applications)

This is where you can create and manage your OAuth apps.

Step 3: Create a New OAuth Application

Click on New Application.

Fill in the fields as follows:

  • Name → Example: Composio GitLab Integration

  • Redirect URI → Paste the Composio callback URL:

Make sure it’s exact (no trailing /).

  • Scopes → Select the following (depending on what you want Composio to access):

    • read_user (to read user profile info)

    • api (to access GitLab APIs)

    • read_api (if you want limited read-only access)

For testing, you can just tick read_user and api.

Scopes supported by Composio:

Below are all the scopes that Composio supports for GitLab. You should add these scopes based on your integration requirements:

These scopes define the permissions your app can request during the OAuth authorization process. It’s essential to select only the scopes necessary for your application's functionality, adhering to the principle of least privilege.

Note: The actual scopes you should request depend on your specific integration requirements.

For example, if your app needs to read and write repository data, you would include read_repository and write_repository in your OAuth configuration.

You can customize these scopes according to your integration needs.

Step 4: Save and Copy Credentials

  1. Click Save application.

  2. GitLab will now show you:

    • Application ID → This is your Client ID.

    • Secret → This is your Client Secret.

Copy the secret immediately, GitLab only shows it once!

Creating the Auth Config in Composio

With your GitLab OAuth credentials ready, let’s configure them inside Composio.

  1. Open the Composio Dashboard.

  2. Click on Create Auth Config.

  1. From the list of toolkits, select GitLab.

  2. Choose OAuth2 as the authentication type.

Step 5: Fill in Your OAuth Details

In the Manage Auth Config section:

  • Client ID → Paste your GitLab Application ID.

  • Client Secret → Paste your GitLab Secret.

  • Redirect URI → Must match exactly:

  • Base

  • Scopes → Add the same scopes you enabled when creating the app (read_user, api, etc.).

* the redirect URL is v3

Click Create Gitlab Auth Config.

Authorise and Connect

  1. Get the External User ID from GitLab in the profile section

  1. In Composio, click Connect Account in your GitLab Auth Config, then enter the User ID you just copied.

  1. The GitLab consent screen will open, displaying the requested permissions.

  2. Click Authorise.

Composio securely stores the access token upon success.

Base URL for GitLab

By default, use GitLab’s hosted API:

If you are using a self-hosted GitLab instance, replace the base URL with your instance’s API endpoint.

That’s it! You’ve now set up OAuth2 credentials for GitLab and connected it with Composio.