triauth for BackstageOIDC
Let your developers sign in to your Backstage portal with one approval on their own device, and no portal passwords.
- Sign-in through
- OpenID Connect bridge
- Available in
- Every Backstage instance
- Set up in
app-config.yaml and the backend
About Backstage
Backstage is a framework for building an internal developer portal. The portal holds a catalog of your services, teams, and APIs, templates for new projects, documentation, and plugins for CI and Kubernetes. A platform team runs one instance, and developers sign in to see and manage what they own.
Connect Backstage to triauth
Backstage signs people in through the triauth OpenID Connect bridge, with its OIDC provider module. Once connected, the portal's sign-in page shows a card with your domain's name and a Sign In button. Developers click it, type their username in the window that opens, and approve on their own device. Nobody keeps a portal password, and when someone leaves, removing their identity records at your domain ends their access to the portal as well.
How it works
In the backend, add the module with
yarn --cwd packages/backend add @backstage/plugin-auth-backend-module-oidc-provider, and addbackend.add(import('@backstage/plugin-auth-backend-module-oidc-provider'));topackages/backend/src/index.ts.Open oidc.triauth.org and enter your domain. Paste the redirect address,
https://backstage.example.com/api/auth/oidc/handler/framewith your own portal address in place ofbackstage.example.com, and click Connect app. The bridge gives you a client ID and a client secret.Add the settings below to
app-config.yaml. Replaceexample.comwith 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.yamlauth: environment: production session: secret: <a long random string> providers: oidc: production: metadataUrl: https://oidc.triauth.org/example.com/.well-known/openid-configuration clientId: <client ID from the bridge> clientSecret: <client secret from the bridge> prompt: auto additionalScopes: [offline_access] signIn: resolvers: - resolver: emailMatchingUserEntityProfileEmailIn the frontend, follow the two code steps of Backstage's guide: create an auth API for the provider id
oidcinpackages/app/src/apis.ts, and give theSignInPageinApp.tsxa provider with that API and the titleexample.com. Restart Backstage.Open the portal and click Sign In.
Checkpoint
The portal's sign-in page shows the card with your domain's name. Choosing Sign In opens a window with a page from the bridge that asks for the username, and the person's authenticator asks them to approve. The window closes and the catalog opens.
Good to know
- Backstage creates no accounts. A person can sign in when the catalog has a User entity whose profile email is their identifier, which is what the resolver above matches. To let only one team in, limit the app to a group when you connect it.
- Teams and ownership come from the Group entities in the catalog, not from the groups published at your domain, which Backstage reads only through a custom resolver.
- Backstage renews its own session through the bridge before it expires and on every page load, and matches the person against the catalog each time. So a removed identity is out at the next renewal. Once the bridge stops renewing a session, for example after a long absence, the sign-in card comes back.
For the person who connects the app
| Setting | Value |
|---|---|
| Redirect address | the backend's auth address plus /oidc/handler/frame, which is https://<your-backstage>/api/auth/oidc/handler/frame in the usual setup. callbackUrl overrides it |
| Where in Backstage | app-config.yaml under auth.providers.oidc.<environment>, the backend module, and the frontend sign-in page. Changes need a restart |
| Discovery | metadataUrl takes the full address, https://oidc.triauth.org/<your domain>/.well-known/openid-configuration |
| Prompt | prompt: auto is required. Without it Backstage sends prompt=none, which the bridge rejects |
| Scopes | additionalScopes: [offline_access] on top of the default openid profile email. Backstage builds its session on the refresh token. Without one, the sign-in window reopens on every page load. A bridge error at a renewal shows the sign-in card too |
| Resolver | emailMatchingUserEntityProfileEmail matches the identifier to spec.profile.email. dangerouslyAllowSignInWithoutUserInCatalog: true lets people in without a catalog entry |
Backstage keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Backstage's OIDC provider guide has the frontend code, and the identity resolver guide explains the resolvers.
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 the portal to one team when you connect it.
- Read Backstage's OIDC provider guide for every setting the module 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.