Skip to content

triauth for LibreChatOIDC

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

  • AI
  • Open source
Sign-in through
OpenID Connect bridge
Available in
Every LibreChat installation
Set up in
The .env file

About LibreChat

LibreChat is a self-hosted chat application that looks like ChatGPT but connects many AI services behind one interface. Teams run it on their own servers, so staff share one AI tool with central control over accounts, models, and costs.

Connect LibreChat to triauth

LibreChat signs people in through the triauth OpenID Connect bridge. Once connected, the sign-in page shows a button with the label you choose. People on your team click it, type their username, and approve on their own device. Nobody keeps a LibreChat password, and when someone leaves, removing their identity records at your domain ends their access to LibreChat as well.

How it works

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

  2. Add the settings below to LibreChat's .env file 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 session secret with a long random string of your own.

    ini
    ALLOW_SOCIAL_LOGIN=true
    ALLOW_SOCIAL_REGISTRATION=true
    OPENID_CLIENT_ID=<client ID from the bridge>
    OPENID_CLIENT_SECRET=<client secret from the bridge>
    OPENID_ISSUER=https://oidc.triauth.org/example.com
    OPENID_SESSION_SECRET=<a long random string>
    OPENID_SCOPE=openid profile email
    OPENID_CALLBACK_URL=/oauth/openid/callback
    OPENID_BUTTON_LABEL=Continue with example.com
  3. Open LibreChat's sign-in page and click Continue with example.com.

Checkpoint

LibreChat's sign-in page shows the new button. 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 a LibreChat account the first time they sign in, and people who already have a local account under the same email address are moved over to the new sign-in. To let only one team in, limit the app to a group when you connect it, or require one of the groups at your domain with OPENID_REQUIRED_ROLE.
  • OPENID_ADMIN_ROLE names the group whose members become LibreChat administrators.
  • The separate Admin Panel signs in through the same connection once its redirect address, https://chat.example.com/api/admin/oauth/openid/callback, is the second one on the bridge.

For the person who connects the app

SettingValue
Redirect addressesDOMAIN_SERVER plus OPENID_CALLBACK_URL, so DOMAIN_SERVER must be the public address. The Admin Panel adds DOMAIN_SERVER plus /api/admin/oauth/openid/callback as the second one
Where in LibreChatthe .env file of the server
IssuerOPENID_ISSUER takes https://oidc.triauth.org/<your domain>, and the rest comes from the discovery document
RolesOPENID_REQUIRED_ROLE and OPENID_ADMIN_ROLE with OPENID_REQUIRED_ROLE_TOKEN_KIND=id and OPENID_REQUIRED_ROLE_PARAMETER_PATH=groups, or OPENID_ROLE_SYNC_* with the claim groups
SessionsOPENID_REUSE_TOKENS=true, OPENID_SCOPE=openid profile email groups offline_access, and OPENID_REUSE_MAX_SESSION_AGE_MS=420000 make LibreChat keep people signed in with the bridge's tokens instead of its own. The sign-in is then renewed through the bridge while a person works and lasts as long as the bridge renews it. Once the identity is gone, or when the bridge cannot be reached at a renewal, the person is signed out. Left off, LibreChat keeps its own login, usually seven days, which the bridge cannot cut short

LibreChat keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. LibreChat's OpenID Connect guide and its environment reference explain 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.