This guide walks system administrators through installing, configuring, and validating the OIDC plugin across two deployment scenarios:
- Adding the plugin to an already running Mattermost cluster.
- Fronting Mattermost with the provided proxy container (or an equivalent Ingress/Nginx deployment) so
/loginautomatically reroutes users into the plugin flow.
For developer workflows (local Docker stack, automated tests, packaging from source), refer to docs/DEVELOPER_GUIDE.md.
Each section contains prerequisites, ordered steps, verification tips, and explicit limitations so you can decide which deployment mode matches your environment.
- Mattermost Server v9.0+ with plugin uploads enabled.
- Administrator access to your Identity Provider (Keycloak v25.x is the reference implementation).
- HTTPS endpoints for both Mattermost and the IdP (dev-only stacks can temporarily allow HTTP via the
Allow insecure issuertoggle).
- Download the plugin package
- Preferred: grab the latest signed archive from GitHub Releases (
mm-oidc.tar.gz). - Need to build from source? Follow the packaging steps in docs/DEVELOPER_GUIDE.md.
- Provision (or reuse) a confidential client in your IdP
- Follow the dedicated Keycloak instructions in KEYCLOAK_SETUP.md or replicate them for your IdP of choice.
- Required mappers:
preferred_username,given_name,family_name,full_name,email, and (optionally) a client-role mapper that emitssystem_admin.
- Upload and enable the plugin
- Sign in to Mattermost as a system admin.
- Navigate to System Console → Plugin Management → Management.
- Enable Plugin Uploads if the setting is disabled, then upload
mm-oidc.tar.gz. - After the upload finishes, click Enable next to
Mattermost OIDC (com.mm.oidc).
- Configure plugin settings
- Open System Console → Plugins → Mattermost OIDC and populate:
Issuer URL:https://<keycloak-host>/realms/<realm>Client IDandClient Secret: from your IdP clientRedirect URL:https://<mattermost-host>/plugins/com.mm.oidc/callbackScopes:openid profile email(appendrolesif you mapped them)- Toggle
Allow insecure issueroff outside disposable labs.
- Click Save and use Start Login to verify the round-trip.
- Open System Console → Plugins → Mattermost OIDC and populate:
- Roll out to users
- Link the plugin landing page (
/plugins/com.mm.oidc/) from your login experience or add a reverse-proxy rule (see section 2) so the plugin drives every interactive login.
- Sign out of Mattermost or open a private browsing window.
- Navigate to
https://<mattermost-host>/plugins/com.mm.oidc/and click Start Login. - Complete authentication with your Identity Provider.
- Confirm the Mattermost UI shows the expected user details and that the
MMAUTHTOKENcookie is present in your browser.
Automated regression scripts live in docs/DEVELOPER_GUIDE.md if you need repeatable validation for CI.
- The plugin cannot override the stock
/loginand/logoutroutes; only/plugins/com.mm.oidc/and/plugins/com.mm.oidc/loginlaunch the flow. - Mobile apps and legacy password clients must continue using the built-in authentication methods until you add a proxy rule or custom UI entry point.
- Server metrics/logging already redact secrets, but Mattermost still displays raw IdP URLs inside the System Console; secure that interface appropriately.
Redirecting /login to /plugins/com.mm.oidc/login requires a front proxy that can inspect cookies and selectively rewrite requests. The repository ships with a ready-to-use Nginx container that you can copy into your own stack.
- Import the service definition
- Reuse the
mattermost-proxyservice block fromdeploy/docker-compose.dev.ymland adjust theports,MM_SITE_URL, and hostname values to match your environment. - Mount the maintained config deploy/mattermost-proxy/nginx.conf via a bind mount or ConfigMap.
- Reuse the
- Wire the network
- Place the proxy and Mattermost containers on the same Docker network.
- Update Mattermost’s
SiteURLtohttp(s)://<proxy-host>so cookies and the plugin’s redirect metadata stay consistent.
- Expose the proxy
- Publish the proxy’s port(s) to your load balancer or ingress; the upstream Mattermost port should remain internal.
- Validate
- In a private browser window, visit the proxy host and confirm unauthenticated requests redirect to
/plugins/com.mm.oidc/login. - Hit
/api/v4/users/loginwithcurl -H 'Accept: application/json'and verify the response is not a redirect. - Open
/plugins/com.mm.oidc/callbackdirectly to ensure it stays reachable (no redirect loops) and that WebSocket upgrades still succeed via/api/v4/websocket.
- ConfigMap – create a ConfigMap with the Nginx template:
apiVersion: v1
kind: ConfigMap
metadata:
name: mm-oidc-proxy-config
namespace: mattermost
data:
nginx.conf: |
# copy the contents of deploy/mattermost-proxy/nginx.conf- Deployment – run the proxy as a sidecar fronting Mattermost:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mattermost-proxy
namespace: mattermost
spec:
replicas: 2
selector:
matchLabels:
app: mattermost-proxy
template:
metadata:
labels:
app: mattermost-proxy
spec:
containers:
- name: nginx
image: nginx:1.25-alpine
ports:
- containerPort: 8787
volumeMounts:
- name: proxy-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx.conf
env:
- name: MATTERMOST_UPSTREAM
value: "http://mattermost:8065"
volumes:
- name: proxy-config
configMap:
name: mm-oidc-proxy-config- Ingress / Service – expose the proxy via your preferred ingress controller, ensuring sticky sessions and TLS termination live at the edge.
- Plugin config – set Mattermost’s
SiteURLto the proxy host and keep the plugin’s redirect URL aligned (e.g.,https://chat.example.com/plugins/com.mm.oidc/callback).
- JSON API clients that send
Accept: application/jsonbypass the redirect by design; keep legacy automation pointed at the upstream/api/v4endpoints. - WebSocket upgrades (
/api/v4/websocket) are passed straight through—ensure your load balancer maintains the connection when chaining another proxy. - If you run multiple Mattermost instances behind the proxy, configure sticky sessions or an external session store so
MMAUTHTOKENcookies stay valid across hosts.