Skip to content

triauth for MatrixOIDC

Let your team sign in to your Matrix server with one approval on their own device, and no chat passwords.

  • Chat
  • Open source
Sign-in through
OpenID Connect bridge
Available in
Every Synapse server
Set up in
homeserver.yaml

About Matrix

Matrix is an open network for secure messaging, and Synapse is the server software most organizations run for it. People use it through Element or another Matrix app, for rooms, direct messages, and calls with end-to-end encryption, and they can talk to people on other Matrix servers as well.

Connect Matrix to triauth

Synapse signs people in through the triauth OpenID Connect bridge. Once connected, the sign-in screen of Element and other apps offers a button with your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a chat password, and when someone leaves, removing their identity records at your domain ends their access to the server as well.

How it works

  1. Open oidc.triauth.org and enter your domain. Paste the server's redirect address, https://matrix.example.com/_synapse/client/oidc/callback with your own server's public address in place of matrix.example.com, and click Connect app. The bridge gives you a client ID and a client secret.

  2. On your server, add the settings below to homeserver.yaml and restart Synapse. Replace example.com with your domain and the two placeholders with the client ID and the client secret from the bridge.

    yaml
    oidc_providers:
      - idp_id: triauth
        idp_name: example.com
        issuer: "https://oidc.triauth.org/example.com"
        client_id: "<client ID from the bridge>"
        client_secret: "<client secret from the bridge>"
        scopes: ["openid", "profile", "email"]
        user_profile_method: "userinfo_endpoint"
        user_mapping_provider:
          config:
            localpart_template: "{{ user.preferred_username }}"
            display_name_template: "{{ user.name }}"
            email_template: "{{ user.email }}"
  3. Open Element, choose your server, and click the button with your domain's name.

Checkpoint

The sign-in screen shows a button with your domain's name. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.

Good to know

  • Everyone with an identity at your domain gets an account on the server the first time they sign in. To let only one team in, limit the app to a group when you connect it.
  • The Matrix username is the person's username at your domain, so john@example.com becomes @john:matrix.example.com. People who already have an account under that name are connected to it only if the person who connects the app allows it with allow_existing_users.
  • Every Matrix app, on the desktop or on a phone, signs in through the same server, so one connection on the bridge covers them all.

For the person who connects the app

SettingValue
Redirect address<public_baseurl>/_synapse/client/oidc/callback, so public_baseurl must be set correctly
Where in Synapseoidc_providers in homeserver.yaml, with the OIDC extras installed, which the Docker images and Debian packages already have
Issuerhttps://oidc.triauth.org/<your domain>, from which Synapse reads the rest
Usernamelocalpart_template with preferred_username, the person's username, which fits Matrix's rules for localparts. A second domain on the same server could repeat a name, so run one server per domain or add a suffix in the template
Groupsattribute_requirements can limit sign-in to people whose groups claim contains a value, with groups added to scopes
Existing accountsallow_existing_users: true to connect accounts that already exist, enable_registration: false to stop new ones

Synapse's OpenID Connect guide and the configuration reference explain every key.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.