triauth for SourcegraphOIDC
Let your engineers open Sourcegraph with one approval on their own device, and no Sourcegraph passwords.
- 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
Open oidc.triauth.org and enter your domain. Paste Sourcegraph's redirect address,
https://sourcegraph.example.com/.auth/callbackwith your own Sourcegraph address in place ofsourcegraph.example.com, and click Connect app. The bridge gives you a client ID and a client secret.As a site administrator, open Site admin › Configuration › Site configuration and add the provider below. Replace
example.comwith 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" } ] }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
requireEmailDomainkeeps everyone else out. To let only one team in, limit the app to a group when you connect it, or setallowSignuptofalseand 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
| Setting | Value |
|---|---|
| Redirect address | https://<your-sourcegraph>/.auth/callback, on the host named in externalURL |
| Where in Sourcegraph | the auth.providers list of the site configuration |
| Issuer | https://oidc.triauth.org/<your domain>, and the rest comes from the discovery document |
| Scopes | openid profile email, fixed |
| Sign-out | ends 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
- Read the OpenID Connect bridge page for what every connected app gets and what the bridge keeps private.
- Read Roll out to your team to give everyone in your organization an identifier at your domain.
- Read Groups to limit Sourcegraph to one team when you connect it.
- Read Sourcegraph's authentication guide for every setting Sourcegraph offers.
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.