|
| 1 | +--- |
| 2 | +title: Create a GitLab OAuth application |
| 3 | +sidebar_position: 75 |
| 4 | +--- |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +- [GitLab](https://gitlab.com) account |
| 9 | +- A [local Minder server](run_the_server) running with the `gitlab_provider` |
| 10 | + feature flag enabled (see [Using feature flags](../developer_guide/feature_flags)) |
| 11 | + |
| 12 | +## Steps |
| 13 | + |
| 14 | +1. Navigate to [GitLab User Settings > Applications](https://gitlab.com/-/user_settings/applications) |
| 15 | + |
| 16 | +2. Click **Add new application** and enter the following details: |
| 17 | + - **Name:** `Minder` (or any name you prefer) |
| 18 | + - **Redirect URI** (add both URIs, one per line): |
| 19 | + ``` |
| 20 | + http://localhost:8080/api/v1/auth/callback/gitlab/cli |
| 21 | + http://localhost:8080/api/v1/auth/callback/gitlab/web |
| 22 | + ``` |
| 23 | + - **Confidential:** Yes (checked) |
| 24 | + - **Scopes:** Check `api`, `read_user`, and `read_repository` |
| 25 | +
|
| 26 | +3. Click **Save application**. Copy the **Application ID** and **Secret** — the |
| 27 | + secret is only shown once. |
| 28 | +
|
| 29 | +4. Add the following to your `server-config.yaml` under the `provider:` section: |
| 30 | +
|
| 31 | + ```yaml |
| 32 | + provider: |
| 33 | + gitlab: |
| 34 | + client_id: "YOUR_APPLICATION_ID" |
| 35 | + client_secret: "YOUR_SECRET" |
| 36 | + redirect_uri: "http://localhost:8080/api/v1/auth/callback/gitlab" |
| 37 | + webhook_secret: "a-random-secret-string" |
| 38 | + scopes: |
| 39 | + - "api" |
| 40 | + - "read_user" |
| 41 | + - "read_repository" |
| 42 | + ``` |
| 43 | + |
| 44 | + The `redirect_uri` should be the base path without `/cli` or `/web` — Minder |
| 45 | + appends the correct suffix automatically. |
| 46 | + |
| 47 | +5. Enable the `gitlab_provider` feature flag by creating `flags-config.yaml` in |
| 48 | + the root of your Minder directory: |
| 49 | + |
| 50 | + ```yaml |
| 51 | + gitlab_provider: |
| 52 | + variations: |
| 53 | + enabled: true |
| 54 | + disabled: false |
| 55 | + defaultRule: |
| 56 | + variation: enabled |
| 57 | + ``` |
| 58 | +
|
| 59 | +6. (Re)start the Minder server: |
| 60 | +
|
| 61 | + ```bash |
| 62 | + make run-docker |
| 63 | + ``` |
| 64 | + |
| 65 | +7. Enroll the GitLab provider using the CLI: |
| 66 | + |
| 67 | + ```bash |
| 68 | + minder provider enroll --class gitlab |
| 69 | + ``` |
| 70 | + |
| 71 | + A browser window will open to GitLab's OAuth authorization page. After |
| 72 | + authorizing, the browser will show **Minder enrollment complete** and the CLI |
| 73 | + will print `Provider enrolled successfully`. |
| 74 | + |
| 75 | +## Known limitations |
| 76 | + |
| 77 | +- GitLab support is currently only available on self-hosted Minder instances. |
| 78 | + The hosted instance at `api.custcodian.dev` does not yet support GitLab |
| 79 | + enrollment. |
| 80 | +- Webhook-based event delivery requires an externally reachable URL. For local |
| 81 | + development, tools like [ngrok](https://ngrok.com) can expose your local |
| 82 | + server. |
| 83 | +- Token identity verification after enrollment is not yet implemented. |
0 commit comments