GitLab in the current backend implementation supports two authentication methods: OAUTH_WEB and PAT, and also supports self-hosted GitLab instances.
Backend Prerequisites
General Configuration:GIT_CREDENTIALS_KEY: Used to encrypt and save connection credentials.BACKEND_PUBLIC_URLorPUBLIC_API_URL: Used to generate theWebhook URLdisplayed on the page.FRONTEND_URL: The address to redirect to after OAuth completion.
GITLAB_CLIENT_IDGITLAB_CLIENT_SECRETGITLAB_REDIRECT_URI(e.g.,http://localhost:3001/v1/git/connections/callback/gitlab)
GITLAB_SCOPES(defaultread_api)GITLAB_BASE_URL(defaulthttps://gitlab.com)GITLAB_OAUTH_AUTHORIZE_URL(defaultGITLAB_BASE_URL + /oauth/authorize)
PAT method, GitLab OAuth-related variables are not required.
Web Configuration Steps
Method 1: OAuth Web
- Open
Settings -> Connectors(/settings/connectors). - Select
Provider = GitLab,Auth method = OAUTH_WEB. - Optionally enter the
GitLab instance URL(baseUrl). If left empty,GITLAB_BASE_URLis used; if also not configured, defaults tohttps://gitlab.com. - Click
Start Connectionto redirect to the GitLab authorization page. - After authorization, you are automatically returned to the connectors page, and the connection appears in the
Existing Connectionslist.
Method 2: PAT
- Select
Provider = GitLab,Auth method = PAT. - The page displays a form with fields:
GitLab Base URL(optional)Personal Access Token(required)
- Fill in and click
Submit Connectionto complete the binding.
Self-Hosted GitLab Notes
baseUrlmust include the protocol; non-standard ports require the port number (e.g.,http://gitlab.company.local:2222).- The callback URL in the GitLab OAuth application must exactly match
GITLAB_REDIRECT_URI. - The
baseUrlentered by users on the Web page overrides the backend default and only affects the current connection.
Webhook Notes
- The page displays the GitLab
Webhook URL. - The current backend version has not implemented webhook event handlers for the GitLab provider, so webhooks do not affect connection, repository reading, and merge request creation capabilities.