Backstage sign-in with self-managed GitLab: how it works
The built-in GitLab provider lets developers sign in to Backstage with the accounts your self-managed GitLab instance already issues. It authenticates against your instance over OAuth, so the instance URL and the OAuth application you register on it decide which GitLab accounts can complete sign-in. A sign-in resolver then maps each GitLab identity to one catalog User entity, and that entity determines the ownership and group relationships the session inherits. This page does not cover installing or upgrading GitLab, or the separate token Backstage uses to read repositories for catalog discovery, which belongs to the GitLab integration page. Confirm both before you start, because sign-in fails in confusing ways when the instance is unreachable from the Backstage backend.
Matching deserves the most attention, so decide the match key before you enable the provider. Matching on email depends on every User entity carrying the same address as the GitLab profile, and an address change breaks the link. Matching on the gitlab.com/user-id annotation pins each entity to the numeric GitLab account ID, which stays the same when a person is renamed. Use the annotation for every person who will sign in, and keep an email match only where your identity data is clean. Keep guest access off in production, as the Backstage authentication documentation advises, and confirm the resolver names your Backstage version ships before you copy them into configuration. Test with one account that has no catalog entity to confirm it receives an error and no session.
What to confirm on GitLab and Backstage before configuring sign-in
Five prerequisites decide whether sign-in works on the first attempt. Each one has a named owner, so confirm them with the GitLab admin, the Backstage platform team, and the network or PKI team before anyone edits the Backstage configuration.
GitLab admin and OAuth application
Backstage cannot start sign-in without a client ID and client secret, so a GitLab administrator must be able to create an OAuth application on the self-managed instance. Confirm with the GitLab admin whether the application is created at instance level, who will hold the client secret after creation, and which redirect URI gets registered. That URI must match the Backstage backend callback path exactly, so agree on the Backstage hostname and path before the admin registers it. Check your GitLab version's administration documentation for the exact menu location.
GitLab authentication docsStable HTTPS names for both products
Backstage and GitLab each need a stable HTTPS hostname that the other side can reach. The browser returns to the Backstage callback after GitLab signs the user in, and the Backstage backend then calls GitLab directly to exchange the authorization code, so both paths must work. Confirm with the network team that the Backstage backend can resolve and reach the GitLab hostname, and that users can reach the Backstage hostname from their browsers. Changing either hostname later means updating the OAuth application and the Backstage configuration together.
Node.js release on the support window
Backstage supports exactly two adjacent even-numbered Node.js releases. As of Backstage 1.46.0, those are Node.js 22 and 24, so the Backstage platform team should pin the runtime to one of them in the build image and in developer environments. Confirm the release line against the versioning policy for the exact Backstage version you install, because the supported list moves as new Backstage releases ship. A runtime outside that list may install and run, but the project does not cover it, which matters when you need a security fix.
Backstage versioning policyPostgreSQL for the production backend
Backstage uses PostgreSQL in production and SQLite for development, and each backend plugin, including authentication, gets its own logical database through Knex. The Backstage platform team should provision the PostgreSQL instance and its credentials before sign-in is configured, because a sign-in test on SQLite does not prove production behavior. Confirm with the database owner the connection settings, the TLS requirements, and the backup schedule that will cover these logical databases.
Backstage architecture overviewInternal certificate authority trust
If GitLab presents a certificate from an internal certificate authority, the Backstage backend must trust that chain, or its token exchange with GitLab fails with a certificate error during sign-in. Ask the PKI team for the root and any intermediate certificates in PEM form, and confirm which hostnames each certificate covers. Check that the Backstage container image or host imports the chain, and that the certificate names match the GitLab hostname you registered. Confirm also whether the same authority issues the Backstage certificate, since users' browsers need to trust it too.
How the sign-in flow crosses your trust boundaries
Sign-in starts in the browser when a user chooses GitLab in the Backstage frontend. The browser is redirected to the GitLab authorize endpoint on your self-managed instance, and GitLab sends the authorization code back to the auth backend, not to the frontend. The backend alone exchanges that code at the token endpoint using the client secret, which never reaches the browser. It then passes the GitLab identity to the sign-in resolver, which looks for a matching catalog entity. The Backstage session is issued only after that match succeeds. When you review this flow, confirm the callback URL points to the backend, the secret is absent from the frontend bundle, and a failed match denies sign-in.
Hand-offs across the browser, Backstage and GitLab trust boundaries during sign-in.
Configuring Backstage sign-in with self-managed GitLab, step by step
This sequence connects Backstage to your self-managed GitLab instance through an OAuth application, stored credentials, per-environment provider settings, a sign-in resolver and a tested sign-in page. Each step ends with a check you can run before moving on. The result is one sign-in path that maps a GitLab account to exactly one catalog User entity.
Create the GitLab OAuth application
A GitLab administrator, or a user with rights to create applications on the instance, registers a new OAuth application for Backstage. Set the redirect URI to the Backstage sign-in callback for each environment, using the GitLab handler path in the Backstage authentication documentation. Confirm that exact path against your Backstage version before you register it. Select only the scopes the provider documentation lists for sign-in. Check: the application's detail page shows the expected redirect URI for the environment, and GitLab has issued the application ID and secret.
Store the client ID and secret
The platform or security team places the client ID and client secret in your secrets store, such as the vault or the Kubernetes secret mechanism your team already operates. Keep both values out of
app-config.yamland out of Git history. Backstage can read them through environment variables referenced from configuration, so each environment gets its own pair. Limit read access to the identity the Backstage runtime uses. Check: the backend starts with the variables set, and the secret value does not appear in any rendered configuration file or in the repository.Configure the GitLab provider per environment
In
app-config.yamland each environment-specific config file, add a GitLab entry under the authentication providers section. Set the base URL of your self-managed GitLab host as the audience, so tokens are checked against your instance. Confirm the exact key names for the audience and the client credentials in the authentication documentation for your Backstage version, because configuration keys can change between releases. Check: the backend starts in each environment without a configuration validation error, and the base URL in each file matches the GitLab host you recorded in the first step.Add a sign-in resolver
Configure a resolver for the GitLab provider that maps the authenticated GitLab identity to exactly one User entity in the software catalog. Choose a matching method your catalog data supports, such as the user's email address or the
gitlab.com/user-idannotation on the User entity. Confirm the built-in resolver names for your version in the authentication documentation. Do not add a fallback that signs in users who have no catalog entity, and do not enable guest access in production. Check: a test run of the resolver with a known GitLab identity returns one User entity reference, and an identity with no catalog entry returns an error.Enable the GitLab sign-in page
Add the GitLab provider to the sign-in page in the frontend app so users see a GitLab option on the login screen. Use the frontend provider setup documented for your Backstage version. Keep guest or other unused providers turned off in production. Rebuild and deploy the frontend to each environment, starting with a non-production one. Check: the login page in the non-production environment shows the GitLab option, and selecting it redirects the browser to your GitLab instance for authorization.
Test sign-in with one account
Sign in with one test GitLab account that has a matching User entity in the catalog, using a non-production environment first. Watch the backend logs for a successful token exchange with the GitLab instance and for the result of the resolver. Confirm that the session resolves to exactly one catalog User entity. Then sign in with a GitLab account that has no catalog entry and confirm that Backstage refuses the sign-in. Check: the test account lands in Backstage under its own identity, and the backend log shows the token exchange completing without errors.
Which GitLab identity fields match which catalog user
This table maps each field a GitLab sign-in can supply to the User entity in the catalog, the resolver that depends on it and the failure if that value changes. Read the numeric user ID as the anchor for matching, because usernames and primary emails are more likely to change. Confirm which profile fields and group data your Backstage version passes through before you write resolver logic.
| GitLab source | Backstage field or annotation | Resolver that relies on it | What breaks if the value changes |
|---|---|---|---|
| Numeric user ID | gitlab.com/user-id annotation on the User entity | Annotation-based or custom resolver, if you add one | Matching fails when the annotation is missing or holds a stale ID |
| Username | User entity name, compared with the sign-in username | Username-matching resolver, where your version offers one | Sign-in fails or matches the wrong user after a username change |
| Primary email | spec.profile.email on the User entity | Built-in email matching resolver | Sign-in fails after the primary email changes in GitLab or the catalog |
| Display name | spec.profile.displayName on the User entity | None, since it is used for presentation only | The portal shows an outdated name, and access decisions are unaffected |
| Group memberships | spec.memberOf on the User entity, filled by group ingestion | Permission policies and any group-based resolver | Access drifts when group ingestion lags or GitLab group paths change |
| Stability ranking | Numeric ID first, then username, then primary email | Prefer the numeric ID wherever your setup can populate it | Matches made on email or username break first after renames |
Choosing a sign-in resolver that matches the right catalog user
Use this tab when your catalog user entities carry the gitlab.com/user-id annotation with the numeric ID from your GitLab instance. The resolver trusts the ID that GitLab returns for the signed-in account, so the match does not depend on a display name or mailbox that a person can change. Confirm that annotation values match the IDs your instance actually returns, because a copied or stale value fails to match without an obvious error.
- What it trusts: the numeric user ID issued by your GitLab instance, compared with the annotation on the catalog user entity.
- Failed match: the resolver throws
NotFoundError, and the next resolver in the list runs. - Order: place this resolver first when the annotation is present, so the most stable identifier is tried before any weaker match.
- Domain restriction: identity matching does not need one, but if you add a domain check, confirm in the authentication docs where it runs relative to the resolver.
- Ingestion: new users need the annotation before their first sign-in, so add it through your catalog ingestion rather than by hand.
Check that every catalog user you expect has the annotation and that a test sign-in resolves to that exact user entity reference.
Use email matching when your catalog is keyed on email addresses, for example when user entities come from a directory that stores work email. The resolver trusts the email address GitLab returns, so it is only as reliable as the account ownership behind that address. Email is easy to read and easy to share across systems, but it changes after renames, marriages and domain migrations, and each change can break matching.
- What it trusts: the email on the GitLab account, compared with the email on the catalog user entity.
- Failed match: the email resolver throws
NotFoundError, and the next resolver runs. If none match, sign-in fails. - Order: place email after the annotation resolver, so a stable ID match is tried first and email acts as the fallback.
- Domain restriction: an allowed-domain check belongs before the email lookup, so addresses outside your company domains are refused early. Confirm the option name and placement for GitLab in the authentication docs.
- Verification: confirm that the email GitLab returns is one the account owner has verified, and decide how your team handles addresses that change.
Check that your directory and GitLab hold the same primary email for each person and that an unlisted domain is refused before any match is attempted.
Username matching suits small teams whose catalog entity names mirror GitLab usernames and whose instance has few accounts. The resolver trusts the GitLab username, which the account owner can usually change and which may become available to another person after an account is removed. Treat it as a convenience for a small, closely managed group, and plan to add a stronger key as the team grows.
- What it trusts: the username returned by GitLab, compared with the catalog entity name (
metadata.name). - Failed match: the resolver throws
NotFoundError, and the next resolver in the list runs. - Order: keep this resolver last among the matching resolvers, so it only applies when the stronger matches fail.
- Reuse risk: confirm with your GitLab administrators how removed usernames are handled, and give someone ownership of offboarding checks.
- Migration: username matching is the quickest to start and the hardest to audit later, so schedule the move to the annotation or email resolver.
Check that every catalog entity name matches a current GitLab username and that someone owns the reuse risk.
This tab covers GitLab users who sign in successfully but have no matching user entity in the catalog, such as contractors, new hires or service accounts. The resolver has nothing to bind to, so the safe default is to refuse sign-in. A fallback that creates or guesses an identity gives access to people the catalog never approved. The Backstage authentication documentation advises against offering guest access in production, which removes the easiest workaround.
- What it trusts: nothing beyond a successful GitLab sign-in, since the catalog holds no entity to match.
- Failed match: let every matching resolver throw
NotFoundError, so sign-in fails with a clear message and the event is logged. - Fallback resolvers: do not add a resolver that signs users in by default or creates an identity from token claims alone.
- Onboarding path: make catalog registration, through ingestion or your own approval process, the step that grants portal access.
- Guest access: keep it disabled in production, and confirm the setting in your deployed configuration.
Check that an unmatched GitLab account fails with a clear message and that your support team knows how to add the missing user entity.
Hardening GitLab sign-in against account mismatch and secret exposure
Most sign-in problems with Backstage and self-managed GitLab come from three places: a secret that leaks, a callback that can be intercepted, or a user who gets in without a matching catalog identity. The six controls below address those paths. Confirm each setting against the GitLab and Backstage versions you run, because defaults and option names change between releases.
Keep the client secret server-side
The GitLab OAuth application issues a client secret that lets the Backstage backend exchange sign-in codes for tokens. Supply it to the backend through your secret store or Kubernetes secrets, as an environment variable read at startup. Keep it out of frontend configuration and out of Git. Search your repositories and built frontend bundle for the value before go-live, and rotate the secret if it has ever been committed or copied into a ticket.
Use HTTPS for base URLs and callbacks
The backend base URL and the callback URL registered in your GitLab OAuth application must both use HTTPS on the same public origin. Over plain HTTP, an attacker on the network path can capture the authorization code during the redirect. Confirm that your reverse proxy forwards the original host and scheme, so Backstage builds the callback from the public address alone. Test the full round trip in each environment, since a mismatched redirect URI fails only at sign-in.
Limit OAuth scopes to sign-in
Request only the scopes sign-in needs to read the signed-in user's profile, and confirm the exact scope name for your Backstage version. A broad scope such as api lets a stolen access token act across the GitLab API for that account. Keep catalog discovery on a separate token with its own scopes, so a leak in one path does not expose the other. Use GitLab's hardening guidance to review the OAuth application on the GitLab side.
Block guest sign-in in production
Backstage includes a guest sign-in provider, and the authentication documentation advises against offering guest access in production. A guest identity has no GitLab account behind it, so anyone who reaches the portal may see whatever that shared identity is allowed to see. It also makes sign-in events hard to attribute to a named person. Remove the guest provider from the production configuration, then confirm that unauthenticated requests to the catalog and other APIs are refused in each environment.
Backstage auth docsRefuse users without catalog entities
A sign-in resolver turns a verified GitLab identity into a Backstage user entity. Configure it to refuse sign-in when no matching catalog entity exists, so a new GitLab account cannot enter the portal on its own. Match on the gitlab.com/user-id annotation where your catalog carries it, since email addresses can change or be reused. Test one account that has no entity and confirm the sign-in is refused with a clear error.
Audit sign-ins and patch on schedule
Record each sign-in attempt, including refused ones, with the provider, user reference and time, and ship those logs to the system your security team reviews. Keep Backstage on a version that still receives fixes: the versioning policy backports high and critical vulnerabilities to releases from the last 6 months where feasible. Plan GitLab patching around its patch releases, which arrive twice a month, and check which versions still get security fixes.
GitLab maintenance policyWhy Backstage GitLab sign-in fails and how to fix it
This table lists the most common reasons Backstage sign-in with a self-managed GitLab instance fails, with the symptom you see, the likely cause and the fix. Read each row from the symptom to the cause, then check the configuration and catalog entries it names. Most failures trace to a mismatch between the GitLab OAuth application, the Backstage configuration and the catalog User entity, so compare those three first.
| Failure | Symptom | Likely cause | Fix |
|---|---|---|---|
| Callback or base URL mismatch | Sign-in leaves for GitLab, but the return step fails or lands on the wrong host. | The base URL or callback URL points at a different host than users browse to, or the audience names a different GitLab host than the one that issued the OAuth application. | Make the frontend and backend base URLs match public hostnames, register the same callback in GitLab, and set the audience to your self-managed GitLab URL. |
| Internal CA not trusted | Backend logs show a TLS certificate error when it calls GitLab's token or user endpoints. | The GitLab instance uses a certificate from an internal certificate authority that the Backstage backend host or container does not trust. | Add the internal root or intermediate certificate to the backend trust store, for example through NODE_EXTRA_CA_CERTS, and confirm the setting works in your image. |
| Missing scope | Sign-in succeeds, but the profile has no username, email or ID, so no resolver can match a user. | The requested scopes omit the permission needed to read the current user's profile, commonly read_user for the GitLab provider. | Request the scopes the provider needs, confirm the GitLab OAuth application grants them, and sign in again so the new token carries them. |
| NotFoundError at sign-in | Users authenticate in GitLab, then Backstage reports that no matching user entity was found. | No catalog User entity matches the GitLab identity under the configured resolvers, usually because the username or email differs from the catalog entry. | Correct or create the User entity, and check that the resolver matches a field that is stable in your catalog and that resolver order is as intended. |
| Missing or stale user ID annotation | Users created before the annotation existed fail to sign in, or resolve to an unexpected identity. | The gitlab.com/user-id annotation is absent from the User entity, or it holds a numeric ID from a different GitLab instance. | Add the annotation with the numeric user ID from your self-managed GitLab, and verify the value for each user who needs to sign in. |
| Changed GitLab username or email | A user who signed in before now gets NotFoundError or resolves to a different catalog identity. | Matching depends on username or email, and a rename or primary email change in GitLab no longer matches the catalog entry. | Update the catalog entity to the new value, and keep the user ID annotation in place so renames do not break matching. Confirm your resolver's match fields. |
| Client secret rotated in GitLab only | Token exchange fails after the OAuth secret changes in GitLab, although sign-in worked earlier. | The new client secret was saved in GitLab, but the Backstage backend still reads the old value from its secret store or environment. | Update the secret in the backend's secret store, reload or redeploy the backend, and confirm the new value is in use before retiring the old one. |
| Guest access left on in production | Users reach the portal without a GitLab sign-in, and audit records show a guest identity. | The guest provider was carried over from development configuration, so sign-in bypasses GitLab and the resolvers. | Remove the guest provider from the production configuration, and confirm that GitLab is the only sign-in provider listed for production. |
Questions buyers ask about Backstage sign-in with self-managed GitLab
How much does Backstage sign-in with self-managed GitLab cost?
Backstage has no license fee: it is Apache-2.0 open source, and the project offers no paid edition. The cost is effort: configuring the OAuth application in GitLab, setting the sign-in provider and resolvers in Backstage, and testing each environment. GitLab licensing is a separate decision. The GitLab pricing page lists Free at 0 dollars, Premium at 29 US dollars per user per month billed annually, and Ultimate as custom priced, with all three tiers available for self-managed installations. Confirm the tier your instance runs and the number of users who will need access before you budget. When you request a quote, ask for one-time configuration effort shown separately from any recurring support or retainer work.
How long does GitLab sign-in for Backstage take to set up?
The duration depends on three drivers, and the number should come from a written scope after a short review of your environment. Identity data quality matters most. If GitLab accounts and catalog User entities have missing, duplicate or outdated emails and user IDs, each mismatch needs a decision and a fix. Certificate work comes next. If GitLab uses an internal certificate authority, the Backstage backend must trust it in every environment, and you should verify that trust from end to end. The number of environments is the third driver, because each one needs its own callback URL, secrets and test pass. Ask any provider which of these assumptions they have made and what would change the estimate.
Can our own team set up Backstage GitLab sign-in alone?
Often yes, if one engineer knows Backstage configuration and someone can administer GitLab. The work is configuration and testing, and the Backstage authentication documentation covers the provider settings. Your team needs four roles in place: a GitLab administrator to create the OAuth application and set its callback URL and scopes, a Backstage engineer to configure the provider and resolvers, catalog owners to confirm User entities, and someone to run the test group. Teams usually slow down on resolver behavior and certificate trust the first time they work with them. If no one on your team has done this before, a fixed-scope engagement can cover planning, configuration, testing and documentation, with the scope agreed in writing before work starts.
What do we need to provide for a GitLab sign-in integration?
Three inputs are needed from your side before configuration starts:
- A GitLab administrator who can create the OAuth application, set its callback URL and scopes, and confirm the instance hostname and certificate chain.
- Owners of the catalog User entities, who confirm that each person's email and identity annotations match their GitLab account.
- A test group in GitLab with a few accounts at different access levels, so sign-in and group behavior can be tested without changing production groups.
Also provide access to the Backstage configuration repository and to each environment's secrets store, and name one person who approves the resolver rules before they reach production.
What usually goes wrong when Backstage signs in through GitLab?
Most failures fall into five groups:
- Callback URL mismatch: the redirect URI in the GitLab OAuth application differs from the one Backstage sends, so consent succeeds but sign-in fails.
- Scope mismatch: the OAuth application grants fewer scopes than Backstage requests, so profile data is missing.
- Certificate trust: the backend does not trust the internal certificate authority, so the token exchange fails with TLS errors.
- Resolver misses: users authenticate but match no catalog User entity, so they sign in without an identity or receive an error.
- Guest access left on: a guest sign-in path remains enabled in production, which the authentication documentation advises against.
Test each of these failure paths in a non-production environment before go-live.
Should Backstage match GitLab users by email or user ID?
Match on a stable identifier first, and use email only under a clear rule. The Backstage authentication documentation advises configuring sign-in resolvers so every provider resolves to the same identity. The gitlab.com/user-id annotation on a catalog User entity lets the resolver match the GitLab user ID, which is more stable than an email address that people change. An email-only match is simpler but breaks when an address changes. Before you open sign-in beyond the test group, decide the resolver order, which email domains are allowed, and what happens when nothing matches. Keep resolver logic under code review, since it controls who gets access.
How DeployOpen scopes and delivers GitLab sign-in for Backstage
DeployOpen treats Backstage sign-in with a self-managed GitLab instance as a scoped piece of work inside your own infrastructure. The OAuth application, requested scopes, sign-in resolvers and user matching are agreed in writing before build starts, then tested and documented for your security and platform teams. Engagements are fixed-scope, and ongoing support is available as a retainer.
How we scope
- The written scope names the GitLab hostname, GitLab version and the Backstage version the sign-in will run against.
- We confirm who may sign in, which GitLab groups or domains are allowed, and keep guest access off.
- Identity mapping is agreed up front: which GitLab attribute matches a user to a catalog entity, and the fallback.
How we build
- Register the GitLab OAuth application for your Backstage backend and keep its client secret out of config files.
- Configure scopes and the sign-in resolver, then test accepted and rejected accounts against the agreed rules.
- Test the browser sign-in flow, sign-out, session expiry and a GitLab account that has been removed.
How we hand over
- Written documentation covers the OAuth application settings, scopes, resolver order, annotations used for matching and the rollback steps.
- Configuration changes are handed over as reviewable files your team can keep in its own version control.
- Your identity and platform engineers get a walkthrough of the matching rules and how to fix a mismatch.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, so sign-in is re-checked when Backstage or GitLab change.
- Upgrades to Backstage move all @backstage packages together, and GitLab upgrades must follow the required upgrade stops.
- Re-run the sign-in tests after each GitLab and Backstage upgrade, since both affect the OAuth flow.

