By NHI Mgmt Group Editorial TeamBased on WorkOS: “Connect your app to GitLab without building OAuth” (March 30, 2026)

TL;DR: GitLab connection handling, token storage, and refresh logic can be moved out of the application and into a managed layer, letting developers request a fresh access token and call the provider API directly, according to WorkOS. That reduces implementation friction, but it also concentrates third-party access governance and secret-handling assumptions in one control point.


At a glance

What this is: This is a tutorial on using WorkOS Pipes to connect GitLab through a managed OAuth flow that returns fresh access tokens on demand.

Why it matters: It matters because IAM and NHI teams still have to govern third-party access scope, token lifecycle, and reauthorization even when the app no longer handles the OAuth plumbing.


Context

Applications that pull data from GitLab or other SaaS tools still need an identity and access model for third-party connectivity, even when the business goal is simply to sync projects or other resources. The operational problem is that OAuth flow handling, token storage, and refresh logic are security controls as much as developer conveniences.

WorkOS Pipes moves those mechanics into a managed layer and returns a usable access token when the backend asks for one. That changes where the control plane lives, but it does not remove the underlying governance requirement around scope selection, reauthorization, and credential handling for connected services.


Key questions

Q: How should teams govern delegated GitLab access in a managed OAuth flow?

A: Treat the managed flow as a delegated-access control point, not as a reason to relax governance. Define the minimum GitLab scope, track who can connect the integration, and require revocation when the business use case ends. The token broker simplifies implementation, but it does not change the need for explicit ownership and lifecycle control.

Q: Why do managed token layers still create security risk for IAM teams?

A: Because they concentrate access authority, refresh logic, and credential handling into a smaller number of control points. If scope is too broad or the broker credentials are poorly governed, the application still gains more access than it needs. Managed infrastructure reduces code complexity, but the authorization model remains fully in scope.

Q: What breaks when OAuth token refresh and storage are hidden from the application?

A: What breaks is the illusion that the application has no identity governance responsibility. The app still depends on delegated access, still needs revocation handling, and still must respond correctly when tokens expire or are reauthorized. The control has moved, but the risk has not disappeared.

Q: What is the difference between a managed OAuth broker and a direct provider integration?

A: A direct integration makes the application responsible for redirects, token storage, and refresh handling. A managed broker centralises those functions behind a service layer, which reduces implementation effort but creates a distinct governance dependency on that layer for access scope, expiry, and revocation.


Technical breakdown

Managed OAuth token flow for GitLab integrations

Pipes changes the integration pattern from application-managed OAuth to a managed token exchange. The app presents a widget, WorkOS handles the provider connection, and the backend requests a fresh GitLab access token when it needs to call the API. This reduces direct OAuth implementation work, but it also means the application now depends on a token broker for availability, scope consistency, and lifecycle state. The important detail is that the app still acts with the user's delegated authority; the control point has simply moved.

Practical implication: treat the managed token layer as part of your access governance boundary, not as a replacement for it.

Scope selection, token freshness, and reauthorization boundaries

The article highlights read_api for read-only project access and api for broader GitLab permissions. That distinction matters because OAuth scopes are the real authorization contract, and a managed flow does not make overbroad scopes safer by default. The example also shows that tokens expire and may require the user to reconnect, which is normal identity lifecycle behaviour for delegated access. In governance terms, expiry and reauthorization are not edge cases; they are the mechanism that limits standing access.

Practical implication: align requested scopes to the narrowest GitLab permission set that supports the use case, then test the reauthorization path.

Secret handling shifts from app code to managed secrets

WorkOS still requires API keys and client IDs, and the article explicitly points to managed secrets for those values. That is important because the developer experience may be simplified while the secret exposure problem remains. The app may no longer store provider refresh tokens, but it still relies on its own credentials to talk to the WorkOS API. From an NHI governance perspective, this is a redistribution of secrets rather than their elimination, so inventory and rotation discipline still matter.

Practical implication: classify the WorkOS API key and related credentials as in-scope machine secrets and govern them with the same lifecycle controls as other NHI secrets.


NHI Mgmt Group analysis

Managed OAuth does not remove identity governance, it relocates it. The article shows that application developers can stop building redirect flows and refresh logic, but the access decision still exists and still needs a control owner. That means the governance burden shifts from application code to the token broker and the integration policy around it. Practitioners should treat this as a control relocation, not a control removal.

Scope design remains the decisive security variable. The difference between read_api and api is not cosmetic, because OAuth scopes define what a delegated token can do. A managed connection flow can simplify implementation while still granting overly broad access if scope selection is loose. The practitioner conclusion is straightforward: constrain delegated access at issuance time, because the token layer cannot compensate for excessive authorization intent.

Credential handling is still present, just at a different layer. The app may no longer store provider refresh tokens, but it now depends on WorkOS API credentials and managed secrets to fetch provider tokens. That creates a new concentration point for machine secret governance, which is exactly where NHI programmes need inventory, rotation, and offboarding discipline. The implication is that simplification for developers often means concentration for governance.

Managed token brokers create a third-party access governance choke point. When multiple providers share the same connection pattern, the risk is not only token leakage but also control-plane overreliance. The identity question becomes who can connect, who can refresh, who can revoke, and how those decisions are audited across providers. Teams should re-evaluate whether their IAM and NHI controls can observe and govern that broker layer with enough fidelity.

Token freshness is a lifecycle control, not a convenience feature. The article normalises expired tokens and reconnect flows, which is healthy because delegated access should not persist indefinitely without review. That makes reauthorization a governance signal, not an error path to suppress. Practitioners should use these expiry events to enforce periodic validation of whether the integration should still exist at all.

From our research library:

What this signals

Managed OAuth changes where access is administered, not whether access exists. For identity teams, the practical question is whether the integration layer has clear ownership for onboarding, scope approval, and revocation across every connected provider.

Delegated-access concentration: A managed token broker can simplify development while creating a single place where third-party access, expiry, and reauthorization decisions must be governed. That concentration is useful only if the owning programme can observe and audit it like any other privileged access path.


For practitioners

  • Define the delegated-access boundary Map which GitLab actions the integration truly needs, then choose the narrowest scope that supports only those actions. Use read_api for read-only metadata access unless code write or merge-request functions are explicitly required.
  • Govern the managed token broker Inventory the WorkOS API key, client ID, and any related machine secrets as production credentials, then apply rotation, storage, and offboarding controls to that control point.
  • Test the reauthorization path Verify what happens when the GitLab connection expires or is revoked, and make sure the user is returned to a controlled reconnect flow rather than a broken backend error state.
  • Separate integration convenience from access authority Document which team owns provider onboarding, scope approval, and revocation for each connected service so the managed layer does not become an unowned shadow access channel.

Key takeaways

  • Managed GitLab connectivity does not eliminate OAuth governance, it relocates it into a token-broker layer.
  • Scope choice remains the most important authorization decision because managed flows still grant real delegated access.
  • Machine secrets, reauthorization, and revocation still need explicit ownership even when the application never handles the OAuth redirect itself.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageThe article still depends on API keys and managed credentials that must not leak.
NHI-07 — Long-Lived SecretsThe flow replaces local token storage but still depends on credentials that require lifecycle control.
Recommendation — Classify the WorkOS API key and related credentials as NHI secrets and monitor them for exposure. Rotate integration credentials regularly and remove any standing access that outlives the use case.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementIA-5 governs authenticator lifecycle, including rotation and revocation of machine credentials.
Recommendation — Apply IA-5 to manage token and API key lifecycle for the integration layer.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe article centers on delegated permissions and scope selection for third-party access.
Recommendation — Use PR.AA-05 to enforce least-privilege scopes for connected GitLab access.
MITRE ATT&CKTA0006;TA0008 — Credential Access; Lateral MovementStolen or overbroad OAuth tokens can enable credential abuse and movement across SaaS boundaries.
Recommendation — Map delegated token exposure to TA0006 and TA0008 to prioritize monitoring of connected SaaS access.

Key terms

  • Managed OAuth: Managed OAuth is an authentication approach where the platform handles authorization flows, token refresh, and credential lifecycle on behalf of the application. It reduces the burden of building access control plumbing directly into agent workflows. In production, it helps limit token exposure and supports repeatable integration with enterprise systems.
  • Delegated Access: Delegated access is permission granted to one identity to act on behalf of another user, service, or system. In NHI environments, this usually appears in OAuth-connected apps and automation tooling. It is powerful, but it must be tightly scoped and reviewed because it can persist long after the original business need ends.
  • Managed Secret: A credential stored and handled through a controlled process rather than embedded in code or exposed to developers broadly. In this pattern, API keys and client IDs still need protection because they can be used to request tokens or interact with the broker on behalf of the application.
  • Token Broker: A token broker is a service that issues, refreshes, or mediates access tokens on behalf of an application. It simplifies implementation, but it also becomes part of the trust chain, so organisations must define ownership, logging, renewal policy, and revocation responsibilities.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on June 12, 2026.
Updated on October 8, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org