Skip to content

triauth for DirectusOIDC

Let your team open the Directus Studio with one approval on their own device, and no Directus passwords.

  • Low-code and data
  • Open source
Sign-in through
OpenID Connect bridge
Available in
The paid tiers, and the grant for small organizations
Set up in
Environment variables

About Directus

Directus sits on top of an existing SQL database and turns it into a web admin panel and an API without writing code. Teams use it as a headless content system, an internal admin tool, or the data layer behind their own apps.

Connect Directus to triauth

Directus signs people in through the triauth OpenID Connect bridge. Once connected, the Studio's login page shows a Log In with button carrying your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a Directus password, and when someone leaves, removing their identity records at your domain ends their access to Directus as well.

Single sign-on is part of Directus's paid tiers and of its grant for small organizations.

How it works

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

  2. Add the settings below to Directus's environment and restart it. Replace example.com with your domain, the two placeholders with the client ID and the client secret from the bridge, and the role ID with the ID of the role new people should get.

    ini
    AUTH_PROVIDERS=triauth
    AUTH_TRIAUTH_DRIVER=openid
    AUTH_TRIAUTH_CLIENT_ID=<client ID from the bridge>
    AUTH_TRIAUTH_CLIENT_SECRET=<client secret from the bridge>
    AUTH_TRIAUTH_ISSUER_URL=https://oidc.triauth.org/example.com/.well-known/openid-configuration
    AUTH_TRIAUTH_IDENTIFIER_KEY=email
    AUTH_TRIAUTH_SCOPE=openid profile email groups offline_access
    AUTH_TRIAUTH_LABEL=example.com
    AUTH_TRIAUTH_ALLOW_PUBLIC_REGISTRATION=true
    AUTH_TRIAUTH_DEFAULT_ROLE_ID=<the ID of the role for new people>
  3. Open the Studio's login page and click Log In with example.com.

Checkpoint

The Studio's login page shows a Log In with 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

  • With public registration on, everyone with an identity at your domain gets a Directus account the first time they sign in, with the default role. To let only one team in, limit the app to a group when you connect it.
  • People who already have a Directus account are connected to it when their External Identifier field holds their identifier. Directus does not match accounts by email address on its own.
  • AUTH_TRIAUTH_ROLE_MAPPING can give roles by the groups published at your domain.

For the person who connects the app

SettingValue
Redirect addresshttps://<PUBLIC_URL>/auth/login/<provider key>/callback, built from the PUBLIC_URL setting, which must be the address people use
Where in Directusenvironment variables, prefixed with the provider key from AUTH_PROVIDERS
Discovery URLAUTH_<PROVIDER>_ISSUER_URL takes the full address, https://oidc.triauth.org/<your domain>/.well-known/openid-configuration
IdentifierAUTH_<PROVIDER>_IDENTIFIER_KEY=email, which the bridge fills with the identifier
GroupsAUTH_<PROVIDER>_ROLE_MAPPING as a JSON object from group names to role IDs, with the claim groups
Sessionswith offline_access in the scope, Directus checks the identity with the bridge each time it renews its own session, usually about once a day of use. When the bridge refuses, Directus sends the person to the login page. Signing in itself does not depend on it

Directus keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Directus's authentication guide explains every variable.

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.