What Is OIDC (OpenID Connect) for Cloud Authentication in GitHub?

What Is OIDC (OpenID Connect) for Cloud Authentication in GitHub?

A comprehensive, zero-prior-knowledge exploration of how GitHub Actions can prove its identity to your cloud provider on the fly — without ever storing a single long-lived password or key.

Imagine a hotel that, instead of handing every guest a physical room key they must carry, remember to return, and risk losing or having stolen, instead issues a fresh, temporary access code the moment each guest walks up to their own door — a code that’s verified instantly against the front desk’s records, works for exactly that one visit, and expires automatically afterward. No key ever sits in a drawer waiting to be stolen; no key ever needs replacing after being lost. OIDC brings this exact model to cloud authentication for GitHub Actions: instead of storing a long-lived password or access key that could leak or be stolen, a workflow proves its identity fresh, every single time, receiving a short-lived credential that’s verified on the spot and expires shortly after. In this guide, we’ll build this idea up completely from zero — what OIDC actually is, why it represents such a meaningful security improvement over the older alternative, precisely how the trust and verification process works, and how to set it up correctly and safely.

1Core Concepts: What OIDC Actually Is

Before any technical mechanics, let’s build a precise, plain-language definition.

What it is: OpenID Connect, commonly abbreviated OIDC, is an identity-verification standard that lets one system prove “who I am” to another system in a secure, verifiable way, using short-lived, cryptographically signed tokens rather than a shared, long-lived secret like a password. In the context of GitHub Actions, OIDC lets a running workflow request a fresh, temporary token proving its identity, which a cloud provider can then verify and use to grant temporary access, all without GitHub and the cloud provider ever needing to share a permanent, stored secret in advance.

Why it exists: Before OIDC support, a workflow needing to access a cloud provider — to deploy an application, for instance — typically needed a long-lived access key or password stored as a secret directly in GitHub, covered in a related guide on GitHub Actions. This approach works, but it creates a permanent, valuable target: if that stored secret is ever leaked, stolen, or simply forgotten about and left active long after it’s needed, it remains a genuine, standing risk indefinitely. OIDC exists specifically to remove this permanent secret from the equation entirely.

Where it’s used: OIDC-based cloud authentication is used wherever a GitHub Actions workflow needs to interact with a cloud provider’s resources — deploying infrastructure, uploading build artifacts to cloud storage, or managing cloud services — replacing what would otherwise require a stored, long-lived credential.

Everyday Analogy

Think of OIDC like showing a passport at an international border, versus using a static, shared password to prove your identity. A passport is issued by a trusted authority, cryptographically hard to forge, and checked fresh at every single crossing — nobody keeps a copy of your passport sitting in a filing cabinet at every border post, waiting to be stolen. OIDC gives GitHub Actions this same passport-like experience: a trusted, verifiable identity checked fresh every time, rather than a static secret stored and reused indefinitely.

Practical example: A workflow needs to deploy a new version of an application to a cloud provider’s infrastructure. Instead of that workflow retrieving a stored, long-lived cloud access key from GitHub’s secrets, it requests a short-lived OIDC token, presents that token to the cloud provider, and the cloud provider — having been configured in advance to trust tokens issued by GitHub for this specific repository — grants temporary access valid only for the duration of that one deployment.

2The Problem & Motivation Behind OIDC for Cloud Authentication

Understanding exactly what long-lived cloud credentials get wrong makes clear why OIDC represents a genuine, meaningful security improvement, not just a convenience.

A long-lived cloud access key stored as a GitHub secret has several inherent, structural weaknesses, regardless of how carefully it’s managed. It exists continuously, whether or not a workflow happens to be running at any given moment — meaning it’s a permanent target for theft, twenty-four hours a day, not just during the brief windows when it’s actually needed. If it’s ever accidentally logged, exposed in an error message, or leaked through any other means, it typically remains valid and usable until someone notices and manually revokes it — a window of vulnerability that could last anywhere from minutes to, in unfortunate cases, months. And managing many such credentials across many repositories creates real, ongoing operational burden: rotating them periodically, tracking which ones are still genuinely needed, and ensuring old, unused ones are properly retired.

OIDC addresses all of these weaknesses at once by removing the permanent credential from the picture entirely. Instead of a secret that exists continuously, a token is requested and issued only at the exact moment it’s needed, and it expires automatically, on its own, shortly afterward — there’s no persistent secret sitting around to leak, and no manual rotation process required, since there’s fundamentally nothing long-lived to rotate.

i
Key Insight

The security improvement OIDC provides isn’t about making credentials harder to steal — it’s about eliminating the standing target altogether. A short-lived token that expires in minutes, and is never stored anywhere persistent in the first place, simply isn’t present to be stolen the way a permanently stored secret is, for the vast majority of the time between deployments.

The core problem OIDC solves: how do you let a GitHub Actions workflow securely access cloud resources, without needing to store a permanent, standing secret that represents an ongoing, continuous security risk regardless of how carefully it’s managed?

3Architecture & Components: The Three Parties Involved

OIDC-based authentication involves a specific, well-defined relationship between three distinct parties, each playing a genuinely different role.
Party

Identity Provider (GitHub)

GitHub acts as the trusted issuer of identity tokens, vouching for the specific workflow run’s identity and cryptographically signing that claim.

Party

Relying Party (The Cloud Provider)

The cloud provider trusts tokens issued by GitHub, having been configured in advance to recognize and verify GitHub’s signature.

Party

Subject (The Workflow Run)

The specific, running workflow whose identity is being asserted — described precisely enough that the cloud provider can grant access to exactly the right, intended workflows and no others.

This three-party structure is the foundation of trust the entire system relies on: the cloud provider never needs to directly, permanently trust every individual repository or workflow with a stored secret — it only needs to trust GitHub, as the identity provider, once, and then verify each specific token’s claims against that established trust relationship every time a token is presented.

3
PARTIES
identity provider, relying party, subject
1
TRUST RELATIONSHIP
configured once, in advance
0
STORED SECRETS
needed once configured

4Internal Working: How a Workflow Actually Authenticates via OIDC

Now let’s walk through exactly what happens internally, step by step, when a workflow authenticates to a cloud provider using OIDC.
flowchart LR
    A["Workflow requests an OIDC token from GitHub"] --> B["GitHub issues a signed token describing this specific run"]
    B --> C["Workflow presents the token to the cloud provider"]
    C --> D["Cloud provider verifies GitHub's signature"]
    D --> E{"Does the token's claims match a configured trust rule?"}
    E -->|Yes| F["Short-lived cloud credentials are issued to the workflow"]
    E -->|No| G["Access is denied"]
    
FIG 4.1 — The internal authentication flow between a workflow and a cloud provider using OIDC

Step by step, in plain language: first, a running workflow, configured with the necessary permission to do so, requests an OIDC token from GitHub’s own identity provider service. Second, GitHub issues a token — a cryptographically signed piece of data — that includes specific, verifiable claims about this exact run: which repository it belongs to, which branch or event triggered it, and other identifying details. Third, the workflow presents this token directly to the cloud provider, as part of an authentication request. Fourth, the cloud provider independently verifies the token’s cryptographic signature, confirming it was genuinely issued by GitHub and hasn’t been tampered with. Fifth, the cloud provider checks whether the token’s specific claims match a trust rule it was previously configured with — for instance, “only trust tokens from this exact repository’s main branch.” If the claims match, the cloud provider issues its own short-lived cloud credentials, valid only for a brief period, which the workflow then uses for the remainder of its task. If the claims don’t match any configured trust rule, access is denied entirely.

?
Why It Matters

This entire process happens fresh, every single workflow run — there’s no persistent credential sitting between runs waiting to be used or stolen. Each run independently proves its identity and receives its own, freshly issued, short-lived access, entirely independent of any previous run’s credentials.

5Data Flow & Lifecycle: From Trust Setup to a Completed Deployment

Following the full journey from initial, one-time trust configuration through to a real, individual deployment shows how all the pieces fit together in practice.
1

The Trust Relationship Is Configured Once

An administrator configures the cloud provider to trust GitHub as an identity provider, and defines specific rules about which repositories and branches are permitted to authenticate this way.

2

The Workflow Is Configured to Request a Token

The workflow file is updated to request the necessary permission to obtain an OIDC token during its run.

3

A Deployment Is Triggered

A developer pushes a change that triggers the deployment workflow, exactly as covered in a related guide on GitHub Actions.

4

The Full Authentication Exchange Occurs

The token request, issuance, presentation, and verification steps detailed in Chapter 4 all happen automatically, within seconds.

5

The Deployment Proceeds Using Temporary Access

The workflow uses its freshly issued, short-lived cloud credentials to perform the actual deployment work.

6

Access Expires Automatically

Once the short-lived credentials’ validity period ends, they simply stop working — no manual revocation or cleanup is needed.

Notice that steps 3 through 6 — the actual, individual deployment — require no ongoing, manual secret management at all, since the entire authentication process is freshly, automatically re-established every single time, based on the one-time trust configuration established in step 1.

6OIDC vs. Stored Secrets: A Direct Comparison

Understanding exactly how OIDC differs from the traditional, stored-secret approach clarifies why this shift represents such a meaningful improvement.
AspectStored Long-Lived SecretOIDC-Based Authentication
Where it livesStored persistently as a GitHub secret, existing continuouslyNever stored — a fresh token is issued and used within each individual run
LifespanValid until manually rotated or revoked, potentially indefinitelyExpires automatically, typically within minutes
If leakedRemains usable until someone notices and manually revokes itAlready expired, or about to, by the time any leak could realistically be exploited
Management overheadRequires periodic manual rotation and careful trackingNo rotation needed — nothing long-lived exists to rotate
Granularity of trustOften broad, since a single stored key may grant more access than any one workflow genuinely needsCan be scoped precisely to specific repositories, branches, or even specific workflow files
!
Warning

Adopting OIDC doesn’t automatically make a workflow secure on its own — the trust rules configured on the cloud provider’s side, covered in Chapter 7, still need to be scoped carefully. An overly broad trust rule can still grant excessive access, even though the underlying credential itself is now short-lived rather than permanent.

7Advanced Topic: Scoping Trust Rules Correctly

The genuine security value of OIDC depends heavily on how precisely the cloud provider’s trust rules are configured — a topic worth understanding in real depth.

A trust rule on the cloud provider’s side defines exactly which OIDC token claims will be accepted as sufficient proof of identity. A poorly scoped rule — for instance, trusting any token issued for any workflow in an entire, large organization, regardless of repository or branch — grants far more access than most individual deployments genuinely need, undermining much of OIDC’s intended benefit. A well-scoped rule, by contrast, trusts tokens only from a specific repository, and often only from a specific branch or a specific, particular type of triggering event, such as only tokens generated from the main branch’s deployment workflow specifically.

Broad (Risky)

Organization-Wide Trust

Trusts any workflow across an entire organization, granting far more potential access than most individual tasks genuinely need.

Narrower

Repository-Specific Trust

Trusts tokens only from one specific repository, a meaningful improvement over organization-wide trust.

Precise

Branch- or Environment-Specific Trust

Trusts tokens only from a specific branch or a specific configured environment, ensuring only genuinely intended deployment paths can authenticate.

The general security principle here mirrors least-privilege access, covered in a related guide on scaling Git for large teams: scope every trust rule as narrowly as the genuine task actually requires, rather than broadly, out of convenience or to avoid configuring several more specific rules.

8Very Advanced Topic: What’s Actually Inside an OIDC Token

Understanding the token’s actual structure and content clarifies precisely what information a cloud provider has available to base its trust decisions on.

An OIDC token issued by GitHub contains a set of specific, verifiable claims — structured pieces of information about the specific workflow run requesting it. These typically include which repository and organization the workflow belongs to, which specific branch or tag triggered the run, what kind of event triggered it (a push, a pull request, a manually initiated run), and often a specific, configured deployment environment name if one was used. Every one of these claims is cryptographically bound to the token’s signature — meaning none of them can be forged or altered without invalidating the entire token’s verification.

i
Key Insight

These claims are precisely what makes fine-grained trust scoping, covered in Chapter 7, possible at all — a cloud provider’s trust rule is fundamentally just a set of conditions checked against these exact claims. The more specific and deliberate the claims a trust rule checks, the more precisely access is limited to exactly the intended, legitimate workflows.

It’s worth understanding that these claims describe the workflow run’s context, not any individual human’s identity — OIDC in this setting authenticates “this specific, automated workflow run,” not “this specific person,” which is an important distinction from other, more familiar uses of OIDC for human user sign-in that some readers may already be familiar with from unrelated contexts.

9Very Advanced Topic: Environments & Approval Gates

OIDC’s claims can be combined with GitHub’s own deployment-environment feature for an additional, genuinely powerful layer of control.

GitHub allows workflows to target a specifically configured environment — a named deployment target, like “production,” that can have its own protection rules, such as requiring a specific person’s manual approval before a workflow targeting it is allowed to proceed. Because an OIDC token’s claims can include which environment a run was associated with, a cloud provider’s trust rule can be scoped specifically to “only trust tokens associated with the production environment” — meaning cloud access is only ever granted to runs that have already passed through whatever manual approval gate that environment requires.

Requiring Manual Approval Before Production Cloud Access

A team configures their production deployment workflow to target a protected “production” environment requiring a specific senior engineer’s manual approval before proceeding. Their cloud provider’s trust rule is scoped specifically to tokens carrying that exact environment claim, meaning cloud access to production infrastructure is only ever granted after that human approval step has genuinely occurred — combining OIDC’s short-lived credential model with a deliberate, human-in-the-loop safeguard for their most sensitive deployments.

10Complex Concept: Auditing & Traceability

Because every OIDC token carries specific, detailed claims about its origin, this approach also provides genuine advantages for tracing exactly what accessed what, and when.

A stored, shared secret used across many workflow runs makes it genuinely difficult to distinguish, after the fact, exactly which specific run performed a given cloud action — the credential itself carries no inherent record of which run used it. An OIDC-based approach, by contrast, means every single cloud authentication event can be traced back to the specific, exact claims of the token that authorized it — which repository, which branch, which run, which environment — providing a genuinely detailed, trustworthy audit trail without any additional manual logging effort required on the workflow’s part.

?
Why It Matters

This traceability becomes especially valuable during a genuine security investigation: rather than asking “which of our many workflows might have used this shared secret around the time of this event?”, an OIDC-based audit trail can answer precisely “this exact workflow run, from this exact repository and branch, performed this exact cloud action, at this exact time.”

11Advantages, Disadvantages & Trade-offs

OIDC-based cloud authentication offers substantial, genuine security benefits, alongside some real considerations worth weighing honestly.
AspectAdvantageTrade-off / Cost
SecurityEliminates the permanent, standing target a stored long-lived secret representsRequires correctly configuring and maintaining trust rules on the cloud provider’s side
Operational burdenNo manual secret rotation ever needed, since nothing long-lived exists to rotateInitial setup involves a genuine, one-time learning curve for teams unfamiliar with the concept
GranularityTrust can be scoped precisely to specific repositories, branches, or environmentsOverly broad trust rules can undermine much of this precision if not configured carefully
AuditabilityEvery cloud action can be traced back to a specific, detailed workflow run’s exact claimsRequires the cloud provider’s own logging and auditing capability to actually capture and surface this detail
Cross-cloud consistencyThe same fundamental approach applies across essentially any cloud provider that supports OIDCEach specific cloud provider’s configuration details and terminology differ somewhat

The core trade-off to internalize: OIDC trades a modest, one-time investment in correct, careful trust-rule configuration for a substantial, ongoing reduction in standing security risk and manual credential-management burden — a trade that becomes more valuable, not less, the more workflows and cloud interactions an organization has.

12Performance & Scalability Considerations

OIDC-based authentication has direct, worth-understanding implications for how cloud access scales across a growing number of workflows and repositories.

Because OIDC removes the need to individually provision, store, and rotate a long-lived secret for every single repository or workflow that needs cloud access, it scales considerably more gracefully than the stored-secret approach as an organization’s number of repositories and workflows grows. Rather than an ever-growing list of individually managed secrets, each requiring its own tracking and periodic rotation, an organization typically maintains a much smaller number of trust-rule configurations on the cloud provider’s side, each scoped to cover an appropriate, well-defined set of repositories or workflows.

↓
STORED SECRETS
needed as workflow count grows
↓
MANUAL ROTATION
burden across the organization
1
TRUST CONFIGURATION
can cover many repositories, scoped appropriately

This scaling benefit compounds precisely because it directly addresses one of the genuine operational pain points covered in a related guide on scaling Git for large teams — managing security and access consistently across a rapidly growing number of contributors and repositories — removing an entire category of manual, error-prone credential management that would otherwise grow linearly, and painfully, with organizational size.

13Security Considerations

While OIDC represents a genuine security improvement, it introduces its own specific considerations that deserve careful, deliberate attention.
!
Warning

An overly broad trust rule — as covered in Chapter 7 — remains the single most significant risk in an OIDC setup. If a cloud provider is configured to trust tokens from an entire organization’s workflows without further restriction, then any workflow anywhere in that organization, including one modified by a compromised or malicious pull request from an external contributor, could potentially obtain the same cloud access. Scope every trust rule as narrowly as the genuine task requires.

As covered in a related guide on GitHub Actions, workflows triggered by pull requests from outside, untrusted contributors receive additional restrictions by default — this same caution applies directly to OIDC token requests, since a workflow modified by an untrusted contributor’s pull request should never be automatically granted the same trust as a change made and reviewed entirely within the organization itself.

It’s also worth remembering that while the token itself is short-lived, the cloud credentials it’s exchanged for still grant real, genuine access for their own validity period — appropriately scoping what those cloud credentials are actually permitted to do, following the same least-privilege principle covered in a related guide, remains just as important as it would be with any other form of cloud access, regardless of how that access was originally obtained.

14Design Patterns & Anti-Patterns

Organizations adopting OIDC develop recognizable habits — some that genuinely realize its full security benefit, and some that quietly undermine it.

The Narrow-Scope-by-Default Pattern configures trust rules as specifically as possible from the very start — scoped to exact repositories, branches, and environments — rather than starting broad and intending to narrow the scope “later,” a step that’s easy to postpone indefinitely once things are already working.

The Environment-Gated Production Pattern combines OIDC trust rules with protected deployment environments requiring manual approval, as covered in Chapter 9, specifically for the most sensitive, production-level cloud access.

DECISION — SHOULD A NEW TEAM START WITH A BROAD TRUST RULE “FOR NOW”? Common Pitfall
The Situation

A team setting up OIDC for the first time configures a broad, organization-wide trust rule to get things working quickly, intending to narrow it down to something more specific once they have more time.

Why This Becomes a Problem

As covered in Chapters 7 and 13, a broad trust rule grants far more access than any single workflow genuinely needs, and “narrowing it down later” is a task that, in practice, is very easy to indefinitely deprioritize once the immediate, working setup no longer feels urgent to revisit.

The Better Pattern

Invest the modest additional time to configure a properly scoped trust rule from the very beginning — repository-specific and, ideally, branch- or environment-specific — since retrofitting proper scoping onto an already broad, working configuration is far less likely to happen than getting it right from the start.

Common anti-patterns to avoid: the Broad-for-Now pattern described above; the Unscoped-Cloud-Permissions anti-pattern (correctly narrowing the OIDC trust rule itself, but then granting the resulting cloud credentials far broader permissions than the actual task requires, undermining much of the careful trust-rule work); and the Ignore-Untrusted-Contributor-Risk pattern (failing to apply the same caution to OIDC token requests from pull-request-triggered workflows that GitHub Actions itself already applies to secrets more broadly, as covered in Chapter 13).

15Best Practices & Common Mistakes

A handful of disciplined habits separate an OIDC setup that delivers its genuine, full security benefit from one that only partially realizes it.
1

Scope Trust Rules as Narrowly as Possible

Configure trust rules to specific repositories, branches, or environments from the start, rather than broadly, out of initial convenience.

2

Combine With Protected Environments for Sensitive Access

Use environment-scoped trust rules alongside manual approval gates for your most sensitive, production-level cloud access, as covered in Chapter 9.

3

Scope the Resulting Cloud Credentials Too

Ensure the actual cloud permissions granted, once authentication succeeds, follow the same least-privilege principle as the trust rule itself.

4

Treat Pull-Request-Triggered Workflows With Extra Caution

Apply the same restrictions to OIDC token requests from untrusted contributors’ pull requests as you would to any other sensitive workflow permission.

5

Use the Audit Trail Actively

Take advantage of OIDC’s detailed, traceable claims for genuine security monitoring, rather than letting that valuable audit detail go unused.

Common mistakes beginners make: configuring an overly broad trust rule to get things working quickly, without returning to properly narrow its scope; assuming OIDC alone makes a workflow secure without also scoping the resulting cloud credentials appropriately; and forgetting that untrusted, pull-request-triggered workflow runs deserve the same caution around OIDC token requests that they already receive around ordinary stored secrets.

16Real-World & Industry Examples

Seeing OIDC-based cloud authentication used in realistic, industry-style scenarios makes its practical value concrete.

A Financial Technology Deployment Pipeline

A company handling sensitive financial data replaces all of its previously stored, long-lived cloud deployment keys with OIDC-based authentication, scoped precisely to specific repositories and gated behind a protected “production” environment requiring a senior engineer’s manual approval — directly eliminating what had previously been a standing, audited security concern around permanently stored credentials.

An Open-Source Project Publishing to Cloud Storage

An open-source project that automatically publishes build artifacts to cloud storage after every release adopts OIDC specifically to avoid maintaining a long-lived, sensitive storage credential inside a public repository’s settings, where the surface area for accidental exposure is inherently higher than in a private, internal project.

A Large Enterprise Standardizing Across Many Teams

A large enterprise with hundreds of repositories, each previously managing its own separate cloud deployment secret, migrates to OIDC-based authentication organization-wide, replacing hundreds of individually tracked, manually rotated secrets with a much smaller, centrally managed, and precisely scoped set of trust-rule configurations.

A Startup Building Cloud-Native Infrastructure From the Start

A newly founded startup, setting up its infrastructure automation from scratch, adopts OIDC-based cloud authentication as its default approach from day one, avoiding entirely the accumulated technical debt of stored, long-lived secrets that many older, more established organizations are still in the process of gradually migrating away from.

17Frequently Asked Questions

Q1Does OIDC eliminate the need for GitHub secrets entirely?
For cloud authentication specifically, yes, as covered throughout this guide — but GitHub secrets remain useful and appropriate for other kinds of sensitive values that aren’t well suited to this identity-based exchange.
Q2Does every cloud provider support OIDC-based authentication from GitHub Actions?
Most major cloud providers do support it, though the exact configuration steps and terminology vary by provider, as noted in Chapter 11 — check your specific provider’s documentation for their precise setup process.
Q3What happens if a workflow’s OIDC token is somehow intercepted?
As covered in Chapters 2 and 6, the token itself is extremely short-lived, meaning an intercepted token has a very narrow window of potential misuse compared to a permanently stored, long-lived secret — though properly scoped trust rules, as covered in Chapter 7, remain essential regardless.
Q4Can I combine OIDC with manual approval requirements for production deployments?
Yes. As covered in Chapter 9, scoping a trust rule to a specific, protected deployment environment lets you require human approval before cloud access is ever granted for that environment’s workflows.
Q5Is a broadly scoped trust rule still safer than a stored secret?
Somewhat, but not nearly as much as a properly, narrowly scoped one — as covered in Chapters 7 and 13, an overly broad trust rule still grants far more access than genuinely necessary, undermining much of OIDC’s intended security benefit.
Q6Does OIDC authenticate an individual person, or the workflow itself?
The workflow run itself, as covered in Chapter 8 — the token’s claims describe the specific repository, branch, and run requesting access, not any individual human’s personal identity.

18Summary and Key Takeaways

What to Remember

  • OIDC lets a GitHub Actions workflow prove its identity to a cloud provider using a short-lived, cryptographically signed token, rather than a permanently stored password or access key.
  • It exists to eliminate the standing security risk a permanently stored secret represents — a leaked, short-lived token has a dramatically smaller window of potential misuse than a leaked, long-lived credential.
  • The system relies on a three-party trust relationship — GitHub as the identity provider, the cloud provider as the relying party, and the specific workflow run as the subject whose identity is being verified.
  • A token’s claims describe the exact run requesting access — repository, branch, event, and environment — and trust rules on the cloud provider’s side should be scoped as narrowly as possible against these claims.
  • Combining OIDC with protected, approval-gated environments adds a genuine, deliberate human checkpoint for the most sensitive, production-level cloud access.
  • OIDC scales considerably better than manually managed, stored secrets as an organization’s number of repositories and workflows grows, replacing many individually tracked secrets with a smaller number of well-scoped trust configurations.
  • The genuine security benefit depends entirely on careful, narrow trust-rule configuration — an overly broad rule undermines much of what makes OIDC a meaningful improvement over the stored-secret approach it replaces.