Skip to main content

Integrate with Mattermost

Support level: Community

What is Mattermost?

Mattermost is an open source collaboration platform for team messaging, workflow orchestration, and integrations.

-- https://mattermost.com/

Preparation

The following placeholders are used in this guide:

  • mattermost.company is the FQDN of the Mattermost installation.
  • authentik.company is the FQDN of the authentik installation.
info

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.

Configuration methods

Mattermost Team Edition can use OAuth 2.0. SAML is available only in Mattermost Enterprise Edition. This guide explains both options.

authentik configuration

Redirect URI changes in authentik 2026.5

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.

To support the integration of Mattermost Team Edition with authentik, you need to create a property mapping and an application/provider pair in authentik.

Create a property mapping

  1. Log in to authentik as an administrator and open the authentik Admin interface.
  2. Navigate to Customization > Property Mappings and click Create. Create a Scope Mapping with the following settings:
    • Name: mattermost-read-user

    • Scope Name: read_user

    • Description: Mattermost Team Edition user profile

    • Expression:

      username = request.user.username

      return {
      "id": request.user.pk,
      "username": username,
      "login": username,
      "preferred_username": username,
      "email": request.user.email,
      "name": request.user.name or username,
      }

Mattermost requires the id and email values from the user profile response. Ensure that users who log in to Mattermost have an email address in authentik.

Create an application and provider

  1. Log in to authentik as an administrator and open the authentik Admin interface.

  2. 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.
    • 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.
      • Note the Client ID and Client Secret values because they will be required later.
      • Add the following Redirect URIs:
        • Strict Authorization: https://mattermost.company/login/gitlab/complete
        • Strict Authorization: https://mattermost.company/signup/gitlab/complete
      • Under Advanced protocol settings, ensure the openid scope and the mattermost-read-user scope mapping are selected.
    • 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.
  3. Click Submit to save the new application and provider.

Mattermost configuration

Mattermost Team Edition supports the GitLab OAuth 2.0 authentication path. This guide configures Mattermost's GitLab authentication settings to use authentik as the OAuth provider. GitLab is not required.

Mattermost displays this sign-in method as GitLab in some areas of the System Console. The login button text can be changed in config.json. If you are using a hosted Mattermost deployment without filesystem access to config.json, you cannot complete this setup.

Mattermost Team Edition does not let you freely set all required GitLab OAuth endpoint values in the System Console. Edit the Mattermost config.json file directly and update the GitLabSettings object.

/opt/mattermost/config/config.json
"GitLabSettings": {
"Enable": true,
"Secret": "<Client Secret from authentik>",
"Id": "<Client ID from authentik>",
"Scope": "",
"AuthEndpoint": "https://authentik.company/application/o/authorize/",
"TokenEndpoint": "https://authentik.company/application/o/token/",
"UserAPIEndpoint": "https://authentik.company/application/o/userinfo/",
"ButtonText": "Log in with authentik"
}

Restart Mattermost after saving the file.

Leave Scope empty as shown so authentik can issue the scopes selected on the provider.

If new Mattermost users should be created on first login, log in to Mattermost as an administrator, open the product menu, select System Console, and navigate to Authentication > Signup. Ensure account creation is enabled, or create Mattermost users before they log in with authentik.

Configuration verification

To confirm that authentik is properly configured with Mattermost, log out and log back in via authentik.

Resources