Skip to main content
One GitLab application covers two things in Kodus:
  • Sign in with GitLab on the sign-in page.
  • Install Gitlab app on the Connect your Git tool step, or Go to OAuth on the OAuth tab when you connect GitLab on Repositories. Both connect GitLab for code review with OAuth.
Skip this page if users sign in with email and connect GitLab with a personal or group access token. A token connection needs no OAuth app.

Prerequisites

  • WEB_DOMAIN: Your Frontend URL (e.g., https://app.yourdomain.com or http://localhost:3000)

Step 1: Create the OAuth App

  1. In GitLab, go to User Settings > Applications
  2. Click New application
  3. Fill in the application name

Step 2: Configure the Redirect URIs

Add both URIs, one per line, in Redirect URI:
The first completes Sign in with GitLab. The second returns from GitLab after you connect GitLab with OAuth. Make sure they match your actual web domain and scheme (http/https).

Step 3: Configure Scopes

Select these scopes:
  • api
  • read_user
  • read_repository
Each flow requests its own scopes:
  • Sign in with GitLab requests read_user only.
  • Install Gitlab app and Go to OAuth request the scopes in WEB_GITLAB_SCOPES (Step 4).
Kody needs api to post review comments and to create, edit and remove webhooks. read_api can read but cannot post.
.env.schema defaults WEB_GITLAB_SCOPES to read_api read_user read_repository. A connection made with that value can read your repositories but cannot post comments or manage webhooks. Set the value shown in Step 4.

Step 4: Add Credentials to .env

Copy the Application ID and Secret from GitLab. Both values go in two pairs of variables, because the web app and the API each read their own:
For self-managed GitLab, replace the host in WEB_GITLAB_OAUTH_URL and API_GITLAB_TOKEN_URL with your instance domain (e.g., https://gitlab.yourdomain.com/oauth/authorize and https://gitlab.yourdomain.com/oauth/token). If you only use one of the two, set only its variables. Restart the web application and the API to apply the changes.