Integrate with GitLab
Support level: authentik
What is GitLab?
GitLab is a DevSecOps platform for source code management, CI/CD, issue tracking, and software delivery workflows.
Preparation
The following placeholders are used in this guide:
gitlab.companyis the FQDN of the GitLab installation.authentik.companyis the FQDN of the authentik installation.
If you enable GitLab's omniauth_auto_sign_in_with_provider setting later, GitLab redirects every sign-in attempt to authentik. To use GitLab built-in authentication, open https://gitlab.company/users/sign_in?auto_sign_in=false.
This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.
authentik configuration
GitLab supports single sign-on with SAML or OpenID Connect (OIDC). Choose one method and follow the matching tab in the GitLab configuration section.
GitLab configuration
Apply the GitLab configuration for the SSO method that you configured in authentik.
- SAML
- OIDC
Configure SAML authentication
Create an application and provider
authentik 2026.5 introduces changes to how the SAML provider behaves. Specifically, the provider now automatically sets the Issuer value to: https://authentik.company/application/saml/<application_slug>/metadata/
Older versions of authentik set this value to authentik by default. If you're running an older version, please set Issuer to https://authentik.company/application/saml/<application_slug>/metadata/, where <application_slug> is the slug that you selected for the application.
-
Log in to authentik as an administrator and open the authentik Admin interface.
-
Navigate to Applications > Applications and click New Application to open the application wizard.
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Take note of the Slug because it will be required later.
- Choose a Provider type: select SAML Provider as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
- Set ACS URL to
https://gitlab.company/users/auth/saml/callback. - Set Audience to
https://gitlab.company. - Under Advanced protocol settings, select an available Signing certificate.
- Set ACS URL to
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
-
Click Submit to save the new application and provider.
-
Navigate to System > Certificates and expand the certificate that you selected for the SAML provider. Take note of the Certificate Fingerprint (SHA1) because it will be required later.
Configure GitLab
Edit the GitLab configuration file and add the following configuration:
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['saml']
gitlab_rails['omniauth_sync_email_from_provider'] = 'saml'
gitlab_rails['omniauth_sync_profile_from_provider'] = ['saml']
gitlab_rails['omniauth_sync_profile_attributes'] = ['email']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_saml_user'] = true
gitlab_rails['omniauth_providers'] = [
{
name: 'saml',
label: 'authentik',
args: {
assertion_consumer_service_url: 'https://gitlab.company/users/auth/saml/callback',
idp_cert_fingerprint: '<Certificate Fingerprint (SHA1) from authentik>',
idp_sso_target_url: 'https://authentik.company/application/saml/<application_slug>/',
issuer: 'https://gitlab.company',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
attribute_statements: {
email: ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'],
name: ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name'],
nickname: ['http://schemas.goauthentik.io/2021/02/saml/username']
}
}
}
]
Run gitlab-ctl reconfigure for a Linux package installation, or restart the container after making changes.
Configure OIDC authentication
Create an application and provider
In authentik versions earlier than 2026.5, all Redirect URIs are automatically treated as Authorization type. If you are using one of these older authentik versions, add only the Authorization URL to your Redirect URIs and do not configure a Post Logout URI.
-
Log in to authentik as an administrator and open the authentik Admin interface.
-
Navigate to Applications > Applications and click New Application to open the application wizard.
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Take note of the Slug because it will be required later.
- Choose a Provider type: select OAuth2/OpenID Connect as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
- Take note of the Client ID and Client Secret because they will be required later.
- Add a Redirect URI of type
StrictAuthorizationwith the valuehttps://gitlab.company/users/auth/openid_connect/callback. - Select any available signing key.
- Under Advanced protocol settings, set Subject mode to Based on the User's Email.
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
-
Click Submit to save the new application and provider.
Configure GitLab
Edit the GitLab configuration file and add the following configuration:
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['openid_connect']
gitlab_rails['omniauth_sync_email_from_provider'] = 'openid_connect'
gitlab_rails['omniauth_sync_profile_from_provider'] = ['openid_connect']
gitlab_rails['omniauth_sync_profile_attributes'] = ['email']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_user'] = ['openid_connect']
gitlab_rails['omniauth_providers'] = [
{
name: 'openid_connect',
label: 'authentik',
args: {
name: 'openid_connect',
scope: ['openid', 'profile', 'email'],
response_type: 'code',
issuer: 'https://authentik.company/application/o/<application_slug>/',
discovery: true,
client_auth_method: 'query',
uid_field: 'preferred_username',
pkce: true,
client_options: {
identifier: '<Client ID from authentik>',
secret: '<Client Secret from authentik>',
redirect_uri: 'https://gitlab.company/users/auth/openid_connect/callback'
}
}
}
]
Run gitlab-ctl reconfigure for a Linux package installation, or restart the container after making changes.
Configure SCIM provisioning (optional)
GitLab SCIM for self-managed instances requires GitLab Premium or Ultimate and SAML single sign-on. GitLab SCIM supports user provisioning, but not group provisioning.
-
In GitLab, open the Admin area.
-
Navigate to Settings > General.
-
Expand SCIM Token and click Generate a SCIM token.
-
Take note of the SCIM API endpoint URL and Your SCIM token values because they will be required in authentik.
-
In authentik, navigate to Applications > Providers and click Create.
-
Select SCIM Provider as the provider type and click Next.
-
Enter the following values:
- Name: choose a descriptive name.
- URL: paste the SCIM API endpoint URL from GitLab.
- Token: paste the SCIM token from GitLab.
- Compatibility Mode: select GitLab.
- Group Property Mappings: remove all selected mappings.
-
Click Finish to save the provider.
-
Navigate to Applications > Applications and select your GitLab application.
-
Click Edit.
-
In the Backchannel Providers field, select the SCIM provider that you created.
-
Click Update to save the application.
Configuration verification
To confirm that authentik is properly configured with GitLab, open GitLab and select the authentik sign-in option. After successful authentication, you are redirected back to GitLab and signed in.