# Gitlab (self-managed)

Estimated time to integrate: 4 minutes

***

## Getting Started

### Requirements

* You have an [iftrue](https://app.iftrue.co) account.
* You have your own Gitlab instance running on your own servers. eg: gitlab.example.com
* You have permission to create Gitlab Applications on your Gitlab Group.

### Variables Required

* Inbound IP addresses `34.36.101.243` `34.36.29.18`
* Outbound IP address `34.73.236.126`
* Callback url for oAuth APP `https://api.iftrue.co/v1/account/gitlab/callback`

### Adding Gitlab as a Git Provider

if you just signed up you will see this screen.

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FyLTQH3ZXCEFpeg5SCPsP%2FScreenshot%202023-07-31%20at%2019.24.15.png?alt=media&#x26;token=31dd2865-f8eb-4bf1-85bc-303bc4f3eb0c" alt=""><figcaption><p>Integrate GIT Provider Screen</p></figcaption></figure>

### Create Gitlab Application

We need to create Gitlab application to integrate iftrue. To access this page,

1. Click **Create Gitlab SSO Bridge**
2. **Navigate** to your Gitlab group settings. (Groups -> Select Group -> Settings)

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FDuJzPEl4b9N9k0uRJgkx%2Fgroup-settigns.png?alt=media&#x26;token=80abea95-9503-44e7-a84a-eae2541c383a" alt=""><figcaption><p>Gitlab Group Application Settings</p></figcaption></figure>

3. Set the callback URL and requested permissions.

**Copy paste the callback URL**

```
https://api.iftrue.co/v1/account/gitlab/callback
```

**We do not require repository read or write permissions.**&#x20;

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FlJBFJY6djBgh9mJbzMko%2FGroup%20441.png?alt=media&#x26;token=00719bdf-249a-4339-90f3-37fa88a75d30" alt=""><figcaption><p>Gitlab Create Application</p></figcaption></figure>

4. **Copy and paste Application id and secret to iftrue**

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FqunMt1bzCo7S6qyhlrD3%2Fcopy-secrets.png?alt=media&#x26;token=0365760d-9435-4af4-be33-b01c5411fe42" alt=""><figcaption><p>Gitlab Application Secrets</p></figcaption></figure>

Copy those newly created application id and secret to iftrue onboarding page shown below.

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FYFpFNq2nTMQLcTAegNnf%2FScreenshot%202023-07-31%20at%2019.36.21.png?alt=media&#x26;token=4964b23e-8937-4837-b402-2b0405d88d34" alt=""><figcaption></figcaption></figure>

5. **Enter your host url**

Insert your gitlab instances URL to the host URL section. This will validate your developers with oAuth.

6. **Create Integration once done**

Once you've created the application and the details, click create integration. This integration will be used by your own landing page in iftrue, which is,&#x20;

<mark style="color:blue;">**https\://\[your-organization-slug].app.iftrue.co**</mark>

When your team wants to signin you will use this address and your team will be able to signin with their Gitlab account by using oAuth 2.0.

7. **Create Access Token to Fetch Data**

We need to create access token to fetch data from your gitlab instance. In order to that,

navigate to groups settings and than click `Access Token`&#x20;

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2F1drQSIV82kQNwAnYmMnp%2Fgat-create-token.png?alt=media&#x26;token=a73cd73c-7232-4629-bb34-a0bad7ff2804" alt=""><figcaption><p>Gitlab Group Access Token Menu</p></figcaption></figure>

Set the token properties as below,

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FnrZDKl1TLucXxXItb9Ij%2Fgitlab-gat.png?alt=media&#x26;token=1917d682-23cd-4080-9cf1-e861529fb0b9" alt=""><figcaption><p>Gitlab Access Token Settings</p></figcaption></figure>

**Copy the access token and paste it to iftrue**

<figure><img src="https://2197265994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT9wQ8QTbpuYT55h9etnB%2Fuploads%2FxcfJ7Ts1CQX7TLFnTvTu%2Fgl-access-token.png?alt=media&#x26;token=72a8fdd2-8981-4657-926b-e565eac74946" alt=""><figcaption><p>Iftrue Gitlab Access Token Settings</p></figcaption></figure>

Hit save and you are ready to go :tada:
