Mattermost GitLab single sign-on

Using GitLab as the sign-in provider for self-hosted Mattermost means registering a GitLab application, choosing the right scopes and confirming your Mattermost version and plan support it. This page covers each step, the limits and the failure points.

On this page

Mattermost GitLab single sign-on: what the integration does

Yes, a self-hosted Mattermost server can use GitLab as its sign-in provider, so people who already authenticate to GitLab can reach Mattermost with the same identity. In this setup GitLab acts as the external identity provider. An application is registered in GitLab, Mattermost sends users to GitLab to authenticate, and the Mattermost server accepts the result from GitLab and starts a session. Mattermost does not hold the password, and the sign-in decision stays with GitLab.

Before you plan anything else, confirm two things. First, confirm which Mattermost edition and plan you are running, because the GitLab option was removed from Team Edition in v11, so Team Edition on v11 or later cannot use it. Second, confirm which GitLab deployment you have (GitLab.com or a self-managed instance you operate), since the registered application and the URLs you configure depend on it. Check the exact System Console fields and redirect URL format in the Mattermost documentation for your server version, and check the GitLab authentication documentation for the application settings it currently supports, because both products change between releases. The Mattermost SAML single sign-on documentation is a useful comparison point, since it describes the other enterprise identity option this group covers.

GitLab sign-in is a separate choice from the SAML and OpenID Connect providers covered in the sibling topics. Pick it when GitLab is already the identity source your team uses, and remember it does not replace the SCIM-style lifecycle controls you may need for leavers. Plan how you will remove access when someone leaves GitLab, because a disabled GitLab account must lead to a disabled Mattermost account, and confirm in the Mattermost documentation how that deactivation is handled for your chosen method. Also decide who owns the GitLab application, the client secret and its rotation, and the operational record of who can change these settings.

What you need before registering GitLab as a provider

Four things must be in place before anyone opens the System Console: a Mattermost server on a supported edition and version, a TLS site URL that matches the redirect URI, a GitLab application you can register and control, and network paths that work in both directions. The cards below cover them in parallel, so the checks can run at the same time across your identity, platform and network teams.

Supported Mattermost edition and version

GitLab sign-in is a Mattermost SSO option, and the pricing page places SSO (SAML, OIDC, OAuth) from the Professional plan upward. Team Edition does not offer GitLab SSO from v11, so a Team Edition server must move to a licensed edition before this configuration is possible. Confirm the current server release and its support end date on the Mattermost releases page before you choose a version to deploy or upgrade to.

Releases page

TLS site URL matching the redirect

The Site URL in the Mattermost System Console must use HTTPS and match the host name that GitLab will redirect users back to. A mismatch between the public address, the proxy configuration and the application's registered callback is the most common cause of a failed first login. Record the exact scheme, host and port now, because the GitLab application needs the same value.

GitLab application ownership

You need permission to create an OAuth application on the GitLab instance, either at instance, group or user level. Decide who owns it before you start. An instance-level application is controlled by GitLab administrators, while a user-owned application depends on one person's account and stops working if that account leaves. Ask the GitLab administrator who will hold the client secret and how rotation will be handled.

Two-way network reachability

Mattermost must reach the GitLab instance to exchange tokens and fetch user details, and the user's browser must reach both systems during sign-in. GitLab must also be able to reach the Mattermost callback address. Test each direction from the Mattermost host and from a user workstation, including any proxy, firewall or egress restrictions in your network. Air-gapped or segmented networks often fail this check first.

GitLab version and hosting model

Record the GitLab version and whether the instance is self-managed, dedicated or hosted by a partner, since the GitLab maintenance policy and upgrade stops determine which releases are supported. Confirm with your GitLab administrator that the instance is on a currently maintained release and that its upgrade plan will not break the OAuth application during a planned upgrade. Ask who is notified when the instance URL or certificate changes.

GitLab maintenance policy

Setting up GitLab single sign-on for Mattermost in order

This sequence takes a self-hosted Mattermost server from a confirmed public address to a tested GitLab sign-in, with each step leaving a check that the next step depends on. It ends with a non-admin account that has signed in and been created with the expected identity.

  1. Confirm the Mattermost site URL and TLS

    Before anything is registered with GitLab, confirm the exact public site URL that users will open, including the scheme, host name and any port, and confirm that it is served over valid TLS from the proxy in front of Mattermost. The redirect URI GitLab checks is built from this address, so it must be settled first. Record the final URL in your change record. Done means that opening the site in a browser shows a trusted certificate and the same address you recorded, with no redirects to a different host.

  2. Create the GitLab application

    In the GitLab instance that will act as the identity provider, create an OAuth application for Mattermost under the owner account your identity team controls. Set the redirect URI to the Mattermost callback path for GitLab, built from the URL you confirmed in the previous step, and select the scopes that match the OAuth 2.0 or OpenID Connect option you intend to use. Check the current Mattermost GitLab documentation for the required callback path and scope names. Done means the application is listed in GitLab with a redirect URI that matches the Mattermost site URL character for character.

  3. Store the application ID and secret

    Copy the application ID and the secret from GitLab straight into your organization's secrets store, with an owner, an access policy and a rotation record. Do not paste them into tickets, chat channels or shared documents. Limit read access to the people who will enter them into the System Console and to the service that manages the Mattermost configuration. Done means the secret can be retrieved by an authorized administrator from the store, and the GitLab application page no longer needs to be opened to recover it.

  4. Enter GitLab endpoints in the System Console

    Sign in to the Mattermost System Console as a system administrator and open the GitLab authentication settings. Enter the GitLab endpoints and the application credentials from your secrets store, using the field names in the Mattermost GitLab documentation, which map to the endpoints GitLab publishes for that instance. Enable GitLab sign-in and save. Done means the Mattermost login page shows a GitLab sign-in option and the save completed without validation errors. If you run GitLab on a private address, confirm that the Mattermost server can reach those endpoints before you test.

  5. Set account and team behavior for first sign-in

    Decide how a new GitLab user becomes a Mattermost account: whether the account is created automatically at first sign-in, which email domains are accepted, and which teams a new user joins by default. Record these choices with the owner of user access, since they determine who can enter your workspace. Confirm the account identifier you rely on, because an identity that changes can create duplicate accounts. Done means the settings match the written decision, and a reviewer has signed off on the default team membership.

  6. Test with a non-admin account

    Sign in with a non-administrator test account from a browser that has no active Mattermost session. Complete the GitLab authorization, then confirm the account appears in the System Console user list with the expected email address and username, and that it has the team membership you set in the previous step. Repeat once from the desktop or mobile app if your users will use them. Done means the test account signs in without manual intervention, and its profile matches the identity recorded in GitLab. Record any mismatch before you widen access.

  7. Confirm the rollout scope before widening access

    Before you enable GitLab sign-in for the wider user base, confirm with your identity and security owners which groups will be allowed in, and whether any existing accounts need to be moved to the new sign-in method. Ask the Mattermost team to confirm the upgrade and support status of your server version so the configuration survives later updates. Done means the rollout group is written down, the test results are filed, and the owners have approved expanding access.

Mapping GitLab identity fields to Mattermost accounts

This table compares the identity and profile fields that move from GitLab into a Mattermost account at sign-in, showing the source, the Mattermost field each value populates, when it refreshes and who owns it. Read it as a checklist to confirm before rollout, since the update timing and matching behavior for each field must be verified against the Mattermost and GitLab documentation for your target versions.

Identity fieldGitLab sourceMattermost field and update timingOwner and what to verify
Stable user identifierGitLab user ID returned by the OAuth or OpenID Connect subject claimStored as the auth data value that links the Mattermost account to GitLab. Set at first sign-in and used for later matchingGitLab owns it. Confirm in the Mattermost docs for your version which claim is used as the identifier
Email addressPrimary email on the GitLab profile, as released in the token claimsMattermost email field. Read at sign-in, so changes in GitLab reach Mattermost only at the next login unless a sync is configuredGitLab owns it. Confirm whether an email change is matched to the existing account or creates a new one
UsernameGitLab username (login handle)Mattermost username. Confirm whether it refreshes on each sign-in and how collisions with existing Mattermost usernames are resolvedGitLab owns the source value. Mattermost may allow local overrides, so verify this in the System Console for your version
Display nameGitLab name field returned in the profile claimsMattermost first and last name fields. Confirm whether the value is overwritten at each sign-inGitLab owns it. Users should not expect edits inside Mattermost to persist if GitLab overwrites them
Group or role dataGitLab group membership or admin flag, if released in claimsMattermost system admin or team membership. Group-based mapping is not confirmed in the supplied sources for GitLab, so verify before relying on itGitLab owns the source. Verify whether any role change is applied at sign-in, by sync, or not at all
Account status and deprovisioningGitLab account block or removalMattermost account active state. A blocked GitLab user may still be active in Mattermost until a separate deactivation runs or the session expires, so verify thisShared. Confirm the deactivation path and how quickly it takes effect for your version
Profile attributes beyond the basicsAvatar, locale or other claims if releasedMattermost profile fields. Confirm which are synced and which remain user-editableGitLab owns the source. Test which fields stay editable in Mattermost after first sign-in

Choosing OAuth 2.0 or OpenID Connect scopes for GitLab

OAuth 2.0 is the older of the two paths. Mattermost uses it to obtain an access token from GitLab and then reads the user's profile through GitLab's API. Its scopes describe what the application may access, so the identity Mattermost receives depends on what the GitLab application was granted. Check which option your Mattermost version presents in the System Console before you copy any values, because the OAuth 2.0 option may be hidden, renamed or converted in later releases.

  • Scope model: The GitLab application requests access scopes, and Mattermost receives only the profile fields those scopes allow.
  • Settings shape: Expect a client ID, a client secret and endpoint values entered by hand, with no discovery document to fill them in.
  • Attribute mapping: Username and email values come from GitLab's API response, so confirm which fields Mattermost maps to its own username and email attributes.
  • Version dependence: Confirm in the Mattermost documentation whether this option is still offered for your version and plan level.

Confirm that the option is still offered on your Mattermost version before you reuse OAuth 2.0 values in a new configuration.

Why chained SSO through GitLab is not a supported pattern

Chained SSO means a user signs in to GitLab through a second identity provider, such as SAML or LDAP, and then expects Mattermost to inherit that chain. In that design Mattermost trusts GitLab, GitLab trusts the upstream directory, and the user's password and MFA are handled one hop away from the application. The source material for this topic lists chained SSO as unsupported, so do not build it as the plan of record. Use GitLab as the direct sign-in provider for Mattermost, or choose a different direct provider, such as the directory or an identity provider that Mattermost documents for its own connection.

The practical consequences show up quickly. Users may meet two MFA prompts or a prompt in one system that the other does not enforce, which makes support harder and weakens the claim that MFA is applied consistently. Account lifecycle also depends on two systems: a user disabled in the upstream directory may still hold a valid GitLab session, and a user removed from GitLab may still exist as an active Mattermost account unless the Mattermost side is deactivated too. Decide in writing which system is the source of truth for disabling a user, how that signal reaches the other system, and who owns the runbook when it fails.

Before committing, verify the current Mattermost position on chained providers in the Mattermost SAML single sign-on documentation and in the vendor's support channel, because the supported combinations can change between releases. If the business case still requires an exception, record it with the vendor in writing, including the version tested, the failure modes accepted, the owner of each deactivation step and the retest plan after each Mattermost upgrade.

Security controls for GitLab sign-in to Mattermost

Signing in to Mattermost through GitLab moves part of the security boundary into GitLab. The controls below cover the connection between the two systems, the secret that joins them, the people who manage the integration, and the offboarding and logging steps that keep both sides in agreement.

TLS and exact redirect URIs

GitLab returns the user to Mattermost with an authorization code, so the redirect URI registered in the GitLab application must match the Mattermost site URL exactly, including scheme, host and path. Serve Mattermost only over TLS, because the sign-in flow passes codes and tokens through the browser. After any change to the site URL, domain or reverse proxy, confirm that the callback in GitLab was updated too. Check the exact callback path for your Mattermost version in its SSO documentation.

Protect and rotate the application secret

The GitLab application secret allows Mattermost to exchange authorization codes for tokens, so anyone who holds it can impersonate the integration. Store the secret in a secrets manager, supply it to Mattermost at runtime, and keep it out of configuration files in version control and out of support bundles. Set a rotation schedule and plan the cutover so the new secret is entered in GitLab and Mattermost in one window. Test a sign-in immediately afterward.

Limit who manages the application

Only a small group should be able to create, edit or delete the GitLab application that Mattermost uses, and to view its secret. Review which GitLab users hold owner or maintainer roles on the group or instance that owns the application, and remove standing access that is no longer needed. Route changes to the redirect URI or secret through a tracked change, so an unexpected edit is visible. Confirm in your GitLab edition who can view application settings.

Enforce MFA in GitLab

Mattermost relies on GitLab's authentication, so the strength of a GitLab sign-in sets the strength of the Mattermost sign-in. Require MFA in GitLab for every user who can reach Mattermost, and check how enforcement treats accounts that have not yet enrolled. Confirm whether Mattermost adds its own second factor for accounts that sign in through GitLab in your version, because the GitLab setting may be the only one that applies.

GitLab hardening guidance

Deactivate in GitLab, then verify Mattermost

Offboarding has two steps: deactivate the user in GitLab, then confirm the matching Mattermost account is disabled. Do not assume that a GitLab change automatically ends an existing Mattermost session. Check the account in the Mattermost System Console and attempt a sign-in as that user. Confirm how long active sessions and API tokens remain valid in your version, and record both checks in the offboarding ticket.

Review audit logs on both sides

Sign-in and administrative events are recorded separately in GitLab and Mattermost, so an investigation needs both records. In GitLab, review audit events for the Mattermost application and for the accounts involved. In Mattermost, review server logs and records of logins, account changes and System Console edits, and forward them to your log platform. Match timestamps and user identifiers across the two systems, and confirm which events each version logs and how long they are kept.

How a Mattermost sign-in is handed to GitLab and back

The sign-in starts in the user's browser, which Mattermost redirects to the GitLab instance. GitLab authenticates the user, including any MFA it enforces, then returns the browser to the Mattermost redirect URI with an authorization result. Mattermost exchanges that result for tokens server-to-server, reads the identity claims, and matches the user to an existing account or creates one in its PostgreSQL database. Check that the redirect URI matches exactly, that the GitLab instance sits where your trust boundary expects, and that MFA is enforced at GitLab rather than assumed in Mattermost.

Sign-in hand-offs between the browser, Mattermost, GitLab and the account store.

Mattermost GitLab single sign-on troubleshooting

This table pairs each common GitLab sign-in failure with its likely cause, the fix, and the first check to run. Work down the rows in order when a login fails, because the redirect URI and application scope problems account for most first-time errors. Where a fact about GitLab editions, plans or license behavior is not confirmed for your version, verify it in your own environment before changing settings.

SymptomLikely causeFixFirst check
Redirect URI mismatch error at GitLab sign-inThe Mattermost site URL differs from the callback URL registered in the GitLab application, or the site is served without TLSSet the site URL to the exact HTTPS address users open, then register the matching callback URL in the GitLab applicationCompare the redirect URI character by character, including scheme, host, port and trailing slash, and check the Mattermost server log for the callback error
Sign-in succeeds at GitLab but Mattermost rejects the loginThe GitLab application was created with scopes that do not include what Mattermost requests, such as the openid, profile and email scopes for OpenID ConnectRecreate or edit the GitLab application so its scopes match the Mattermost GitLab configuration guide, then retryOpen the application settings in GitLab and list its scopes against the documented requirements for your Mattermost version
Invalid client or token exchange failureThe application secret was copied with extra spaces or from the wrong application, or the secret was rotated in GitLab without updating MattermostCopy the secret again from the GitLab application, paste it into the System Console, and save the changeConfirm the application ID and secret pair match the same GitLab application, and check the log for the token request error
Mattermost cannot reach GitLab during sign-inThe GitLab instance is not reachable from the Mattermost server because of DNS, firewall, proxy or certificate trust problemsResolve the hostname from the Mattermost server, allow outbound HTTPS to the GitLab instance, and add the internal certificate authority to the trust store if neededRun a connectivity test from the Mattermost server to the GitLab discovery endpoint and review the server log for timeout or certificate errors
Duplicate account or username conflict after first loginExisting Mattermost users share an email address or username with the GitLab account being matchedResolve the duplicates in Mattermost, then sign in again, or migrate the existing account to GitLab authentication with the documented migration commandSearch the user list for the email address and username in question and compare them with the GitLab profile
GitLab used as a link in a chained provider setup failsChained SSO, where GitLab sits behind another identity provider, is not a supported configuration for MattermostConnect Mattermost directly to one supported identity provider, or move the upstream identity into that providerDiagram the sign-in chain and confirm Mattermost talks directly to the provider it is configured for
GitLab sign-in option missing or disabledThe GitLab sign-in option is not available on the Mattermost edition or plan in use, or GitLab SSO was removed from Team Edition in v11Confirm the edition and plan against the Mattermost pricing and release documentation, then upgrade the plan or choose a supported providerCheck the installed Mattermost version and the license tier shown in the System Console
Users remain active after the GitLab account is deactivatedMattermost does not deactivate accounts automatically when a GitLab account is blocked, so the Mattermost user stays enabledDeactivate the matching Mattermost accounts through the System Console or the API, and set a process that removes access when GitLab access endsCompare the list of blocked GitLab users with active Mattermost users sharing the same email address

Questions buyers ask before setting up GitLab SSO for Mattermost

Can our own team set up GitLab SSO for Mattermost without a partner?

Yes, if you have administrators for both systems who can make the changes and test them. On the Mattermost side, SSO over SAML, OIDC and OAuth is included from the Professional plan, so the plan level is not the blocker. On the GitLab side, someone must create the OAuth application, set its redirect URI and manage its secret. Your team must also provide admin access to both systems, a written test plan with named test users, and a named owner for the GitLab application who will handle renewals and changes. If your Mattermost instance runs Team Edition, confirm your edition first, because GitLab SSO was removed from Team Edition in v11. A partner can take on the build and testing if your team lacks the time or the skills.

How long does GitLab SSO for Mattermost take to set up?

No duration is fixed in advance, so ask for a timeline in the written scope rather than relying on a general estimate. The main drivers are the Mattermost version you run, since Mattermost releases a new server version on the 16th of each month and v11.7 is the current Extended Support Release with support ending 2027-05-15, so the version you standardize on sets the upgrade work. Other drivers are where GitLab is hosted and which version it runs, the number of users and groups that must sign in, whether an existing directory or identity setup must be reconciled, and how much testing is needed across web, desktop and mobile clients. Testing with real pilot users usually takes longer than the configuration itself, so plan for it explicitly.

What does GitLab SSO for Mattermost cost, and what drives the effort?

The cost has three recurring or one-time components: software subscriptions, implementation labor and infrastructure. Mattermost sells prepaid annual subscriptions based on seat licenses and does not publish prices, so you must contact sales for a quote. GitLab's pricing page lists Free at 0 US dollars, Premium at 29 US dollars per user per month billed annually, and Ultimate as custom priced, and all three tiers are available for self-managed installations. Your GitLab tier is a separate decision from the Mattermost SSO setup. Effort rises with the number of environments you test in, the number of identity configurations, the amount of user migration and the hosting model for GitLab. Ask any partner for a fixed-scope quote that lists deliverables, environments and what is excluded.

Should we use OAuth 2.0 or OpenID Connect for GitLab sign-in in Mattermost?

Choose the protocol your Mattermost version documents for GitLab, and confirm the choice against the current Mattermost SSO documentation before you build. The practical difference is what identity data you get back at sign-in. OpenID Connect returns an ID token that carries identity claims such as the user identifier, email and username, which Mattermost needs to match or create accounts. OAuth 2.0 is an authorization framework, so identity lookups may require additional calls to the GitLab API. Whichever you choose, verify that the claim Mattermost uses for the username and the unique identifier are stable and present for every user. Changing this later can force account matching work, so settle it in the test plan before any user signs in.

Can GitLab sign-in be chained behind another identity provider for Mattermost?

No, chained SSO is not a supported configuration for Mattermost with GitLab, so do not design around it. In a chain, Mattermost would trust GitLab, and GitLab would trust an upstream provider such as a corporate directory or a second SSO service. That layering is outside what the Mattermost setup supports, and failures in the middle hop are hard to diagnose. If your goal is one login for everyone, the supported options are to connect Mattermost directly to the upstream provider, or to use GitLab as the direct provider for users who already hold GitLab accounts. Confirm the supported options with Mattermost's SSO documentation for your version before you make the decision.

What changes for Mattermost users on the day GitLab SSO goes live?

Users who already have Mattermost accounts with email and password will typically be asked to sign in through GitLab, and their accounts must match correctly or they may appear as new users with empty message history. Plan the account matching before cutover. Mattermost documents the mmctl user migrate-auth command for moving existing accounts to a new authentication method, and it supports dry runs and a mapping file, so use them on a copy of your user list first. Expect existing sessions in the web, desktop and mobile apps to end, so users may need to sign in again. Communicate the new sign-in page, the expected prompts and who to contact if their account does not match. Test the cutover with a pilot group before the full rollout.

How does Mattermost handle accounts when GitLab disables a user?

Do not assume that disabling a user in GitLab automatically deactivates that user in Mattermost. Sign-in federation controls who can log in, but it does not by itself guarantee that a leaver's Mattermost account is deactivated at the time GitLab changes. Confirm this behavior in your Mattermost version with a test: disable a test user in GitLab, then check whether they can still sign in and whether the account state changes. If it does not change, document a leaver process that deactivates the Mattermost account through the System Console or an administrative API call, and assign an owner for it. Review this process when you upgrade, and confirm it with your auditor's control expectations.

Does GitLab SSO for Mattermost work in an air-gapped deployment?

It can, but both systems must run inside the isolated network and reach each other directly, and the setup needs more planning than a connected deployment. GitLab documents running self-managed instances in offline, air-gapped environments, and Mattermost lists air-gapped deployment in its Enterprise Advanced plan. Confirm that your plan includes air-gapped support before you commit. Plan how each system receives updates, how TLS certificates are issued and trusted inside the network, how the redirect URI resolves internally and how keys and secrets are stored. Every upgrade of either system will also need an offline path. Ask for these items in the written scope so the sign-in path is tested under the same network controls as production.

How DeployOpen scopes and delivers Mattermost GitLab single sign-on

DeployOpen plans, configures and documents GitLab sign-in for self-hosted Mattermost inside your own infrastructure, so your identity, security and operations teams can review each setting before users depend on it. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • Confirm your GitLab edition, hosting model and whether GitLab is your primary identity source for Mattermost users
  • Record which Mattermost plan and server version you run, since SSO availability depends on plan level
  • Decide whether GitLab OAuth 2.0 or OpenID Connect scopes match the attributes your Mattermost users need
  • Document how chained SSO is excluded from the design and which sign-in path each user group will use
  • Agree in writing the deliverables, test accounts, cutover criteria and any retainer for later support

How we build

  • Create the GitLab application with redirect URIs that match your Mattermost site URL and TLS configuration
  • Configure the Mattermost System Console SSO settings using client credentials kept out of shared configuration files
  • Validate the scopes returned for email, username and identifier, and test with accounts from each relevant group
  • Test sign-in, sign-out, session expiry and rejected accounts in a staging Mattermost before production
  • Review how the chosen design interacts with MFA, provisioning and removal processes you already run

How we hand over

  • Deliver a written configuration record listing every System Console setting, the GitLab application and its owner
  • Provide a runbook for rotating the GitLab client secret and updating Mattermost before the old secret expires
  • Walk your administrators through test results, known limits and the steps to confirm after each Mattermost upgrade
  • Document the removal of GitLab SSO for Team Edition deployments in the version history your team keeps
  • Hand over evidence in a format your compliance and security reviewers can check against their own control requirements

How we support

  • Offer ongoing support, upgrades and continuous testing as retainers for teams that want a partner on call
  • Retest the GitLab sign-in path after each Mattermost server upgrade and each GitLab upgrade stop
  • Review changes to GitLab application settings, scopes and secrets on a schedule agreed in the scope
  • Keep the configuration record current so your own team can operate the integration without the original builders
  • Confirm any vendor-specific behavior with Mattermost or GitLab documentation before changing production settings

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.