Skip to content

triauth for BackstageOIDC

Let your developers sign in to your Backstage portal with one approval on their own device, and no portal passwords.

  • Code and DevOps
  • Open source
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

  1. In the backend, add the module with yarn --cwd packages/backend add @backstage/plugin-auth-backend-module-oidc-provider, and add backend.add(import('@backstage/plugin-auth-backend-module-oidc-provider')); to packages/backend/src/index.ts.

  2. Open oidc.triauth.org and enter your domain. Paste the redirect address, https://backstage.example.com/api/auth/oidc/handler/frame with your own portal address in place of backstage.example.com, and click Connect app. The bridge gives you a client ID and a client secret.

  3. Add the settings below to app-config.yaml. 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.

    yaml
    auth:
      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: emailMatchingUserEntityProfileEmail
  4. In the frontend, follow the two code steps of Backstage's guide: create an auth API for the provider id oidc in packages/app/src/apis.ts, and give the SignInPage in App.tsx a provider with that API and the title example.com. Restart Backstage.

  5. 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

SettingValue
Redirect addressthe 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 Backstageapp-config.yaml under auth.providers.oidc.<environment>, the backend module, and the frontend sign-in page. Changes need a restart
DiscoverymetadataUrl takes the full address, https://oidc.triauth.org/<your domain>/.well-known/openid-configuration
Promptprompt: auto is required. Without it Backstage sends prompt=none, which the bridge rejects
ScopesadditionalScopes: [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
ResolveremailMatchingUserEntityProfileEmail 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

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.