Mattermost OpenID Connect SSO with any provider

A planning and build guide for signing in to self-hosted Mattermost through the generic OpenID Connect option, covering the discovery endpoint, client credentials, username claims and checks before rollout.

On this page

How to set up Mattermost OpenID Connect SSO with any provider

If your self-hosted Mattermost should sign users in through an identity provider that has no named preset, use the generic OpenID Connect option in the System Console. The work is registering a client in your provider, entering its discovery endpoint and client credentials in Mattermost, and mapping the claim that Mattermost uses as the username. The integration covers how users authenticate and which identifiers Mattermost accepts, and little else. Your identity provider owns profile attributes such as names, email addresses, and group membership, so changes to those belong in the provider, not in Mattermost. Confirm with Mattermost, Inc. that SSO is included in the plan you hold, since the pricing page lists SSO (SAML, OIDC, OAuth) from the Professional plan upward, and check the current entitlements there before you commit.

Before you open the System Console, decide which claim will serve as the username and which will serve as the stable identifier for each person. Test this against real accounts in your provider, because a claim that changes when someone renames or moves between departments will create duplicate or orphaned accounts later. Confirm the exact client redirect URI that your Mattermost site URL requires, and confirm that the site is served over TLS, because most providers will refuse plain HTTP callbacks. Ask the provider's team which scopes it grants by default and whether it returns preferred_username in the ID token or only at the userinfo endpoint, since that determines whether the username mapping works without extra configuration.

Plan for the work after the first sign-in succeeds. Client secrets expire in most providers, so record the expiry date and assign an owner who will rotate the secret in both systems. Test with a pilot group, confirm that existing email-password accounts still work during the cutover, and document what happens to a user whom the provider disables. Account creation and removal, along with MFA enforcement, are covered in their own sections of this guide, so keep your rollout checklist focused on the sign-in path and the claims it depends on.

What you need before you configure Mattermost OpenID Connect SSO

Six items have to be in place before the System Console settings make sense. Most failed first logins trace back to one of them, usually the redirect URI or a server address that the provider cannot reach. Check each card with the people who own the server, the identity provider and the DNS record.

A supported self-hosted server

Confirm that your Mattermost server version is inside its support window before you change authentication. Check the current support dates on the server releases page, because the dates for the latest monthly releases and Extended Support Releases differ. Plan the SSO change on a version you can upgrade from without a gap, and record the exact version number in your change ticket.

Server releases page

A plan that includes SSO

OpenID Connect sign-in is part of the SSO capability that the pricing page lists from the Professional plan. Confirm with Mattermost sales that your subscription includes it, and confirm the seat count your license covers. The pricing page does not publish prices, so ask for the license terms in writing before you plan the rollout.

Pricing page

A public HTTPS site URL

The Mattermost site URL must be a public HTTPS address that users' browsers and the identity provider can both reach. The OpenID Connect redirect returns to this address, so an internal hostname or a plain HTTP address will break the callback. Confirm the DNS record, the certificate chain and the proxy routing before you touch the provider.

A registered OpenID Connect client

Create the client at the provider and set the redirect URI to the path that your Mattermost version documents. Confirm the exact redirect path for your version in the Mattermost docs before you register it, because a mismatch returns an error at sign-in. Record the client ID and client secret in your secrets store, not in a ticket.

A reachable discovery endpoint

The generic option reads the provider's OpenID configuration document from a discovery endpoint, so the Mattermost server must be able to make an outbound request to it. Check that the URL resolves from the server's network, that any egress proxy or firewall allows it, and that the certificate is trusted by the server's operating system store. A discovery URL that works in a browser does not prove the server can reach it.

An admin account for the System Console

Someone with system admin rights must enter the OpenID Connect settings in the System Console. Keep at least one email-based admin account working before you enable SSO, so a misconfigured provider cannot lock every administrator out. Agree in advance who reviews the saved settings and who can roll them back if sign-in fails.

Configuration sequence for the generic OpenID Connect connector

This sequence takes a Mattermost server from no external sign-in to a working OpenID Connect login through a provider you choose, with each step closed by a check you can repeat. The output is a tested login path that creates accounts with the expected username and email.

  1. Register the Mattermost client at the provider

    The identity administrator creates an OpenID Connect client or application in the provider for your Mattermost site, sets the redirect URI the provider's documentation and the Mattermost SSO settings describe for the generic option, and grants the openid, profile and email scopes. Record the client ID and client secret in your secrets store, not in a ticket or chat. The step is done when the provider shows the application as enabled and the client secret is stored.

  2. Confirm the discovery endpoint returns expected metadata

    Open the provider's OpenID Connect discovery URL, usually ending in /.well-known/openid-configuration, in a browser from a machine that can reach it. Confirm the response is valid JSON and lists the issuer, authorization endpoint, token endpoint, userinfo endpoint, and the supported scopes and claims you need, including preferred_username or the claim you plan to use for usernames. Check that the issuer value matches the issuer your provider reports elsewhere. The step is done when the document loads without a certificate warning and contains those fields.

  3. Confirm the Mattermost site URL and TLS

    The Mattermost administrator confirms that the Site URL in the System Console is the exact public HTTPS address users will open, because the redirect back from the provider must match it. Verify the certificate chain is trusted by the provider and by the machines users sign in from. A mismatch between the configured site URL and the registered redirect URI is one of the most common causes of failed sign-in, so check both values character by character. The step is done when the site URL loads over HTTPS in a fresh browser session with no certificate warning.

  4. Enable the OpenID Connect option and enter provider settings

    In the System Console, the Mattermost administrator opens the authentication settings, enables the generic OpenID Connect option, and pastes the discovery endpoint, client ID and client secret from step one. Leave the other sign-in methods enabled until testing finishes so a misconfiguration does not lock out administrators. The step is done when the fields save without validation errors and the client secret shows as stored rather than in plain text.

  5. Set the username claim and map email

    Set the username claim to preferred_username if the provider issues it, or to the claim your provider actually returns for usernames, and confirm the email claim is present in the ID token or userinfo response. Use a test account to decode or inspect the claims returned at login, so you know the exact names rather than assuming them. The step is done when the claim names you entered match the values in a real token from a test user.

  6. Save and confirm the login button appears

    Save the configuration, then open the Mattermost login page in a private browser window. The check is that the OpenID Connect sign-in button appears with the label you set, and that clicking it sends you to the provider's login page with the expected client ID and scopes in the request. If the button is missing, confirm the setting saved and that the server configuration reloaded. The step is done when the button is visible and the redirect reaches the provider.

  7. Test with a non-admin account in a private window

    Sign in with a standard user account that has no system admin role, in a private browser window, and complete the provider login and any MFA it requires. Confirm the new Mattermost account is created with the expected username and email, and that the user lands in the default team and channels. Repeat with a second account to check usernames do not collide. Record the results, then keep an administrator session open so you can revert the change if the test fails. The step is done when the non-admin account has the correct username, email and access, and the admin session still works.

How identity claims map to Mattermost user fields

This table compares each Mattermost user field with the OpenID Connect claim that usually fills it, who controls that value, and what breaks when it changes. Confirm every claim name in your provider's token or userinfo output before you map it, because providers differ in naming and in which claims they send by default. Treat the stable identifier and the username as the two values that most often cause account mismatches later.

Mattermost fieldTypical provider claimWho owns the valueWhat breaks if it changes
Emailemail (confirm it is sent and verified)Identity provider administrator or user directoryReturning users may be matched to a new account or fail to sign in if the address is reused or edited
Usernamepreferred_username or the claim you chooseIdentity provider, often the sign-in nameMentions, direct message links and bot references can point to the wrong person or break after a rename
First namegiven_nameIdentity provider, usually HR or the directoryDisplay names change at the next login or sync, which can confuse colleagues in channels
Last namefamily_nameIdentity provider, usually HR or the directorySame as first name; a mistyped value is copied to the profile until the source is corrected
Stable identifier for returning userssub (confirm it is unique and never reassigned)Identity provider, assigned once per accountIf this value changes or is remapped to another claim, existing users are treated as new and history can detach from the account
Refresh behavior for provider-owned attributesAll of the above, as the provider sends themIdentity provider; Mattermost applies the configured behaviorEdits made in Mattermost to provider-owned fields are overwritten at the next login or sync, so change them at the source

How a Mattermost login flows through the identity provider

The sign-in starts in the user's browser, which sends them to the OpenID Connect provider for authentication. Mattermost reads the provider's discovery document to find the authorization and token endpoints, then receives an authorization code on its HTTPS callback. The server exchanges that code for tokens using the client secret, reads the user claims, and either creates a new account or matches an existing one. Check that the redirect URI matches exactly and that the callback is served over TLS.

Sign-in between the browser, Mattermost and the OpenID Connect provider.

Security controls for the OpenID Connect connection

The OpenID Connect connection gives your identity provider the power to decide who gets into Mattermost, so the controls below sit on both sides of the trust relationship. Transport security, secret handling, provider-side expiry and access scope protect the sign-in path, while admin review keeps the roles granted through it under watch.

Serve Mattermost and the callback over TLS

Mattermost and its OpenID Connect callback must both be reached over HTTPS, and the redirect URI registered at the provider must use the same scheme and host as the Mattermost Site URL. Mismatches cause sign-in failures that teams often work around by loosening settings, so confirm the redirect URI character for character during testing. Check that certificates are valid and that the reverse proxy in front of Mattermost terminates TLS with current protocol settings.

SSO documentation

Protect the client secret in configuration

The client secret issued by the provider is effectively a password for the Mattermost application. Store it in the server configuration file or in your secrets management system, not in a ticket, chat or shared runbook, and limit read access on the configuration file to the service account and the administrators who maintain it. Confirm that database backups and support bundles do not expose the value in plain text.

Track the client secret expiry date

Most providers let you set an expiry on a client secret, and an expired secret stops all sign-in through the connection without warning inside Mattermost. Record the expiry date in your certificate or secret calendar, assign an owner, and plan rotation before the date arrives. Rotation means generating a new secret at the provider, updating the server configuration and testing sign-in before retiring the old value.

Restrict which users can authenticate

Decide at the provider which users or groups may request the Mattermost application, because a provider that allows any directory user to sign in will create Mattermost accounts for all of them on first login. Use the provider's application assignment or group rules, and confirm that disabled or departed identities are blocked at the provider. Test with an account outside the permitted group to verify the restriction works.

Enforce MFA at the identity provider

Where your identity provider supports multi-factor authentication, require it in the policy that applies to the Mattermost application so that every sign-in through the connection is covered. Confirm with the provider which factors satisfy the policy and whether the policy applies to all sign-in paths. Note that enforcing MFA inside Mattermost is a separate setting for accounts that do not sign in through SSO, so it does not replace provider-side enforcement for OpenID Connect users.

SSO setup guide

Review admin access after go-live

Users who arrive through the connection may inherit system admin or other elevated roles depending on how claims are mapped, so review the System Console user list and role assignments once users have signed in. Remove any roles that were granted by default or by mistake, and record who holds system admin access and why. Repeat this review after each change to the provider's group or claim configuration.

Why the Mattermost OpenID Connect login fails

This table maps the symptoms administrators most often see when OpenID Connect sign-in to Mattermost breaks to their likely causes and fixes. Start with the Mattermost server logs and the identity provider's sign-in logs, since they usually name the failing step before you change any setting. Most failures trace back to a URL, a claim or a trust relationship that differs between the two systems.

SymptomLikely causeFix
Provider shows a redirect URI error after sign-inThe redirect URI registered at the provider does not exactly match the callback Mattermost sends, including scheme, host, port and pathCopy the callback URL from the Mattermost OpenID Connect settings and register it exactly at the provider, then test again
Sign-in redirects to the wrong host or portSite URL in System Console does not match the public address users reachSet Site URL to the public HTTPS address behind your proxy and confirm the proxy forwards the original host header
Login page fails before the provider screen appearsMattermost cannot reach the discovery endpoint from the server, often due to egress rules, DNS or proxy settingsTest the discovery URL from the Mattermost host itself, then correct firewall, DNS or proxy configuration on that host
TLS handshake errors when calling an internal providerThe provider uses a certificate issued by an internal certificate authority that the Mattermost server does not trustInstall the internal root and intermediate certificates in the server trust store and restart Mattermost
Users sign in but Mattermost rejects the accountThe claim configured as the username (for example preferred_username) is missing from the ID token or scopes do not include itConfirm the scopes requested and the claims the provider includes in the ID token, then map the username claim to one the provider always sends
Users are asked to pick a new username or get a second accountThe email or username claim changed at the provider, so Mattermost matches a new identity instead of the existing oneKeep the stable identifier the provider owns, decide how existing accounts are linked, and test with a copy of the user before rollout
Sign-in works for some users and fails with a secret error for others, or everyone fails at once after a set dateThe client secret has expired or was rotated at the provider without updating MattermostCheck the secret expiry date at the provider, create a new secret, update the System Console setting and record the next rotation date

When to use the generic option and when a named provider page fits better

Microsoft Entra ID, Google Workspace and GitLab each have a sibling guide that walks through the provider's console, redirect URIs and System Console fields in the order Mattermost expects. For these providers, the named guide is usually the faster and safer path because the provider-specific details are already written out, including the Entra ID redirect URI that requires TLS, the Google People API step and the GitLab choice between OAuth 2.0 and OpenID Connect scopes. The trade-off is that each guide assumes a standard configuration, so your team still has to check it against the tenant or account it actually uses.

  • Tenant and consent settings: confirm the app registration type, who grants consent and whether admin consent is required in your tenant.
  • Client secret lifetime: record the expiry date of the client secret and name an owner to renew it before it lapses.
  • Redirect URI and TLS: confirm your Mattermost site URL uses TLS, since the Entra ID path depends on it.
  • Attribute behavior: check which attributes sync into Mattermost and which stay controlled by the provider.

Check the redirect URIs, scopes and attribute settings in your provider's console against the sibling guide before you copy any value into the System Console.

Converting older OAuth 2.0 settings to the OpenID Connect option

Teams that already sign users in to Mattermost through an OAuth 2.0 configuration need to carry a small set of values into the generic OpenID Connect option without changing the identity provider application they already own. The client ID and client secret can usually stay the same, provided the existing application in the identity provider is registered for the Mattermost redirect URI that the new option expects. Endpoints, scopes and claim names are where the two configurations diverge. In the older OAuth 2.0 setup, each authorization, token and user information URL was typed in by hand. With OpenID Connect, the discovery endpoint publishes those URLs from the issuer address, so the authorization, token and userinfo endpoints should be checked against the provider's published metadata rather than copied from the old form. Scopes also need a review: the openid scope is required for OpenID Connect, and the claim that carries the login name, such as preferred_username, must match what the provider actually returns in the ID token or userinfo response.

Confirm, in the System Console and in the server release notes for your version, which of these settings the upgrade carries across automatically and which must be re-entered by hand. Do not assume that a saved OAuth 2.0 value will appear populated in the new fields, and do not assume that a blank field means the value was lost. Build the new configuration on a staging server first, then sign in with a dedicated staging account that exists in the identity provider and has a known email address and login name. Check that the account is matched to the correct Mattermost user, that the email and username land in the expected fields, and that a user who already has an account is not duplicated. Keep the old OAuth 2.0 settings in place, and keep a note of the previous values, until the cutover has been verified with several accounts, including one with an administrator role. Rolling back should then mean switching the login method back rather than rebuilding the provider application from scratch.

Questions buyers ask before hiring help with Mattermost OIDC SSO

How much effort does a generic OpenID Connect setup for Mattermost take?

Effort depends mostly on four factors: how many identity providers you connect, how much claim design the team has to settle, how much testing you require before rollout, and how many environments (test, staging, production) the configuration must pass through. A single provider with an agreed claim set and one test group is a small, bounded task. Each additional provider, each environment and each open question about which attribute names the directory actually holds adds work. Ask any partner for a written scope that lists the providers, environments, test cases and deliverables, then price against that list rather than against a general estimate.

What does our team need to supply before the work starts?

Four things remove most of the delay. First, administrator access to the identity provider so the client application, redirect URI and claims can be created and tested. Second, a stable public HTTPS address for the Mattermost server, because the redirect URI and discovery endpoint depend on it. Third, a test group of real users in the provider who can sign in during validation. Fourth, named decision makers who will approve the claim mapping, especially which claim becomes the username and which one identifies the user across changes. Missing any of these usually stalls the project at the testing stage.

Can our internal team set up Mattermost OIDC SSO without outside help?

Yes, many teams can do this themselves if they have someone comfortable with OpenID Connect concepts, the identity provider's administration console and Mattermost's System Console. The tasks are a client registration, a discovery endpoint, client credentials, claim mapping and a sign-in test. The harder parts tend to be claim design, handling accounts that already exist with email logins, and proving the configuration to reviewers. Assess whether the team has time to test failure cases such as expired secrets and users missing required attributes. Outside help is most useful when the team needs a second set of eyes on the design or a documented, repeatable result.

How does OIDC sign-in fit with user provisioning and deprovisioning?

OIDC handles authentication, meaning who the user is at sign-in. It does not by itself keep profiles current or remove people who leave. Users created at first login follow the provider's identity, but accounts of departed staff stay active unless something else deactivates them. Plan a separate provisioning and deprovisioning path, such as directory-based synchronization, scheduled reviews through the API, or a documented manual process, and confirm with your identity provider which attributes it can push or pull. Decide this before go-live so that leavers do not keep access through an otherwise working SSO setup.

Which claims and identifiers should we confirm before configuring the provider?

Confirm three things with the people who own the directory. The username claim, usually preferred_username, must be unique and must not change when a person's name or email changes. The email claim must match how your organization identifies people. The stable identifier must never be reused or edited, because changing it later can detach a user from their history. Also confirm which attributes the identity provider owns, such as name, job title or group membership, since those usually cannot be edited in Mattermost without breaking the link to the provider. Write these decisions down so they survive staff changes.

Does DeployOpen issue an audit report on our Mattermost SSO setup?

No. DeployOpen does not issue audit reports, attestations or certifications. DeployOpen can prepare the configuration, the access settings and the evidence your own compliance team or independent assessor will ask for, such as a description of the sign-in flow, the claim mapping decisions, test results and the configuration records. The assessor then decides what the evidence supports. Ask your assessor early which artifacts they expect, so that the setup is documented in the form they will review.

What happens to existing Mattermost users when we switch to OIDC?

Existing accounts that signed in with email or another method do not automatically move to the new provider. Plan how current users will be matched to their identity provider accounts, and whether message history must stay attached to each person. Mattermost provides a migration command for changing authentication methods, and it is worth reading its documentation before you decide the approach. Test the matching on a copy of your data, and confirm with your team how many accounts may need manual review.

How DeployOpen scopes and delivers Mattermost OIDC SSO

DeployOpen treats Mattermost OpenID Connect SSO with any provider as a fixed-scope piece of work inside infrastructure you control. We agree the provider, redirect URI, claim mapping and rollout plan in writing before configuration starts, then test sign-in end to end and hand over documentation your identity and platform teams can operate.

How we scope

  • Confirm the OpenID Connect provider, its discovery endpoint and the public URL Mattermost will use for callbacks.
  • Agree which claim carries the username, how email and identity fields map, and which attributes the identity provider owns.
  • Write the scope, deliverables and timeline down before work starts, with ongoing support available as a retainer afterward.

How we build

  • Register the client in your provider, record the client ID and secret handling, and configure the generic OpenID Connect settings in the System Console.
  • Convert any existing OAuth 2.0 settings to the OpenID Connect configuration, and check that the redirect URI matches exactly over TLS.
  • Test sign-in with test accounts, including accounts that already exist, so account matching and the chosen identifier behave as planned.

How we hand over

  • Deliver a runbook covering the provider settings, Mattermost configuration keys and the steps to rotate the client secret.
  • Document which user attributes Mattermost will not update after first login, so administrators know where profile changes must be made.
  • Walk your identity and operations staff through the sign-in flow, the rollback path and the checks to repeat after each Mattermost upgrade.

How we support

  • Offer retainers for ongoing configuration changes, upgrade testing across Mattermost monthly and Extended Support releases, and provider changes.
  • Retest sign-in after server upgrades or identity provider changes, and update the runbook with what changed.
  • Confirm support terms, response expectations and what the retainer excludes in the written agreement before signing.

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.