Skip to content

triauth for SourcegraphOIDC

Let your engineers open Sourcegraph with one approval on their own device, and no Sourcegraph passwords.

  • Code and DevOps
  • Commercial
Sign-in through
OpenID Connect bridge
Available in
Sourcegraph Enterprise, cloud and self-hosted
Set up in
Site configuration

About Sourcegraph

Sourcegraph indexes all of a company's source code repositories, so engineers can search across them, jump to definitions and references, and run large-scale code changes. The Cody assistant adds AI help on top of the same index. Teams use a cloud instance managed by Sourcegraph or run it themselves.

Connect Sourcegraph to triauth

Sourcegraph signs people in through the triauth OpenID Connect bridge. Once connected, the sign-in page shows Continue with and your domain's name. Engineers click it, type their username, and approve on their own device. Nobody keeps a Sourcegraph password, and when someone leaves, removing their identity records at your domain ends their access to Sourcegraph as well.

How it works

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

  2. As a site administrator, open Site admin › Configuration › Site configuration and add the provider below. Replace example.com with your domain and the two placeholders with the client ID and the client secret from the bridge.

    json
    {
      "externalURL": "https://sourcegraph.example.com",
      "auth.providers": [
        {
          "type": "openidconnect",
          "issuer": "https://oidc.triauth.org/example.com",
          "clientID": "<client ID from the bridge>",
          "clientSecret": "<client secret from the bridge>",
          "displayName": "example.com",
          "requireEmailDomain": "example.com"
        }
      ]
    }
  3. Open Sourcegraph's sign-in page and click Continue with example.com.

Checkpoint

Sourcegraph's sign-in page shows Continue with example.com. 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 Sourcegraph account the first time they sign in, and requireEmailDomain keeps everyone else out. To let only one team in, limit the app to a group when you connect it, or set allowSignup to false and create the accounts yourself.
  • Sourcegraph takes the account name from the person's username, such as john. Repository permissions come from your code hosts, and the groups published at your domain are not used.
  • Single sign-on is part of Sourcegraph Enterprise, the plan the product is sold on.

For the person who connects the app

SettingValue
Redirect addresshttps://<your-sourcegraph>/.auth/callback, on the host named in externalURL
Where in Sourcegraphthe auth.providers list of the site configuration
Issuerhttps://oidc.triauth.org/<your domain>, and the rest comes from the discovery document
Scopesopenid profile email, fixed
Sign-outends the Sourcegraph session. The bridge has no revocation or sign-out endpoint, and Sourcegraph treats both as optional

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

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.