> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab

export const title_1 = "GitLab";

export const title_0 = "GitLab";

## Setup Guide

Follow these steps to connect GitLab to your Connect AI account:

<Steps>
  <Step>
    Open the **Sources** page of the Connect AI navigation menu.
  </Step>

  <Step>
    Click **+ Add Connection** in the upper-right corner.
  </Step>

  <Step>
    Type *GitLab* into the search field, then click the data source name.
  </Step>

  <Step>
    On the **Basic Settings** tab of the new connection, enter a connection name or keep the default name.
  </Step>

  <Step>
    Select the Authentication method, then proceed to the relevant section and follow those instructions.
  </Step>
</Steps>

## Authentication Methods

<Tabs>
  <Tab title="OAuth">
    To use OAuth authentication, you need to register an OAuth application with GitLab. You can register either a user-owned application or a group-owned application:

    <Steps>
      <Step>
        Open the **Applications** page in GitLab:

        * **User-owned**–select your avatar in the upper-right corner, click **Edit profile**, then select **Applications** from the left sidebar.
        * **Group-owned**–open the group, then in the left sidebar select **Settings** > **Applications**.
      </Step>

      <Step>
        Click **Add new application**.
      </Step>

      <Step>
        Complete the required fields:

        * **Name**–the name of your application.
        * **Redirect URI**–set this to *[https://oauth.cdata.com/oauth/](https://oauth.cdata.com/oauth/)*.
        * **Confidential**–leave this checkbox selected.
        * **Scopes**–select the OAuth 2.0 scopes your integration needs (for example, `api`, `read_user`, `read_api`, `read_repository`).
      </Step>

      <Step>
        Click **Save application**.
      </Step>

      <Step>
        On the application page, make note of the **Application ID** and **Secret**. The Secret is only shown once, so copy it immediately. In Connect AI, the Application ID is entered as the **OAuth Client Id** and the Secret as the **OAuth Client Secret**.
      </Step>
    </Steps>

    In Connect AI:

    <Steps>
      <Step>
        Enter the **OAuth Client Id** and **OAuth Client Secret** obtained from GitLab.
      </Step>

      <Step>
        Click **Sign in** to connect securely through OAuth. This action opens the GitLab sign-in page in a new tab.
      </Step>

      <Step>
        Log in to your GitLab account and provide the requested permissions (if applicable).
      </Step>

      <Step>
        Connect AI **Add {title_0} Connection** ページ上部の、**Save & Test** をクリックします。

        * 接続テストに成功すると、コネクションが作成されたことを示す**Connection successfully saved** というメッセージが表示されます。**Edit Connection** ページの**Status** も**Authenticated** に変わります。**Edit Connection** ページの右ペインにある**Data Model** タブで、成功したコネクションのデータモデルを表示します。
        * 接続テストに失敗した場合は、入力したログイン情報に余分なスペースや文字がないかを確認してください。Connect AI は、データが不足している必須フィールドの下にエラーメッセージを表示します。一部のデータソースでは、ソースのWeb サイトに直接サインインする必要があります。サインインしていない場合は、**Sign in** ボタンの下にエラーメッセージが表示されます。エラーを修正し、もう一度試してください。
        * 失敗したコネクションは下書きとして保存され、**Status** は**Not Authenticated** になります。後でコネクションに戻って認証することができます。
      </Step>
    </Steps>
  </Tab>

  <Tab title="APIKey">
    To use API Key authentication, first create a personal access token in GitLab:

    <Steps>
      <Step>
        Select your avatar in the upper-right corner and click **Edit profile**.
      </Step>

      <Step>
        In the left sidebar, select **Access Tokens** (or **Access** > **Personal access tokens** on newer GitLab versions), then click **Add new token**.
      </Step>

      <Step>
        Complete the required fields:

        * **Token name**–a descriptive name for the token.
        * **Expiration date**–required by GitLab.
        * **Scopes**–select the scopes your integration needs. Use `api` for full read/write API access, or narrower read-only scopes such as `read_api`, `read_user`, and `read_repository`.
      </Step>

      <Step>
        Click **Create personal access token**.
      </Step>

      <Step>
        Copy the token immediately and store it securely. GitLab only displays the token once.
      </Step>
    </Steps>

    In Connect AI:

    <Steps>
      <Step>
        Enter the **API Key**.
      </Step>

      <Step>
        Connect AI **Add {title_1} Connection** ページ上部の、**Save & Test** をクリックします。

        * 接続テストに成功すると、コネクションが作成されたことを示す**Connection successfully saved** というメッセージが表示されます。**Edit Connection** ページの**Status** も**Authenticated** に変わります。**Edit Connection** ページの右ペインにある**Data Model** タブで、成功したコネクションのデータモデルを表示します。
        * 接続テストに失敗した場合は、入力したログイン情報に余分なスペースや文字がないかを確認してください。Connect AI は、データが不足している必須フィールドの下にエラーメッセージを表示します。一部のデータソースでは、ソースのWeb サイトに直接サインインする必要があります。サインインしていない場合は、**Sign in** ボタンの下にエラーメッセージが表示されます。エラーを修正し、もう一度試してください。
        * 失敗したコネクションは下書きとして保存され、**Status** は**Not Authenticated** になります。後でコネクションに戻って認証することができます。
      </Step>
    </Steps>
  </Tab>
</Tabs>
