Skip to main content
OIDC Auth is a platform-agnostic JWT-based authentication method that can be used to authenticate from any platform or environment using an identity provider with OpenID Connect.

Diagram

The following sequence diagram illustrates the OIDC Auth workflow for authenticating GitHub workflows with Infisical.

Concept

At a high-level, Infisical authenticates a client by verifying the JWT and checking that it meets specific requirements (e.g. it is issued by a trusted identity provider) at the /api/v1/auth/oidc-auth/login endpoint. If successful, then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API. To be more specific:
  1. The GitHub workflow requests an identity token from GitHub’s identity provider.
  2. The fetched identity token is sent to Infisical at the /api/v1/auth/oidc-auth/login endpoint.
  3. Infisical fetches the public key that was used to sign the identity token from GitHub’s identity provider using OIDC Discovery.
  4. Infisical validates the JWT using the public key provided by the identity provider and checks that the subject, audience, and claims of the token matches with the set criteria.
  5. If all is well, Infisical returns a short-lived access token that the GitHub workflow can use to make authenticated requests to the Infisical API.
Infisical needs network-level access to GitHub’s identity provider endpoints.

Guide

In the following steps, we explore how to create and use identities to access the Infisical API using the OIDC Auth authentication method.
1

Creating an identity

To create an identity, head to your Organization Settings > Access Control > Identities and press Create identity.identities organizationWhen creating an identity, you specify an organization level role for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.identities organization createNow input a few details for your new identity. Here’s some guidance for each field:Once you’ve created an identity, you’ll be redirected to a page where you can manage the identity.identities pageSince the identity has been configured with Universal Auth by default, you should re-configure it to use OIDC Auth instead. To do this, press to edit the Authentication section, remove the existing Universal Auth configuration, and add a new OIDC Auth configuration onto the identity.identities page remove default authidentities create oidc auth method
Restrict access by configuring the Subject, Audiences, and Claims fields
Here’s some more guidance on each field:
Subject field: On GitHub.com, repositories created after July 15, 2026 use an immutable subject format where the owner and repository names are suffixed with their permanent numeric IDs using @ as the delimiter: repo:octocat@583231/example-repo@1296269:ref:refs/heads/main. Renaming or transferring a repository after that date also switches it to this format, and existing repositories can opt in at the organization or repository level through GitHub’s OIDC settings or REST API. GitHub Enterprise Server is unaffected. If the subject you configure doesn’t include these IDs, authentication fails with a 403 error. To get the exact prefix your repository’s tokens carry, run gh api repos/<owner>/<repo>/actions/oidc/customization/sub and copy the sub_claim_prefix value into your subject. A glob pattern such as repo:octocat@*/example-repo@*:ref:refs/heads/main can serve as a temporary workaround during migration, but it also matches recycled owner and repository names with different IDs, so hardcode the IDs whenever possible.
If you are unsure about what to configure for the subject, audience, and claims fields you can use github/actions-oidc-debugger to get the appropriate values. Alternatively, you can fetch the JWT from the workflow and inspect the fields manually.
The subject, audiences, and claims fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible. See General OIDC Auth for glob pattern matching behavior and examples.
2

Adding an identity to a project

To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project.To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press Add identity.Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to.identities projectidentities project create
3

Accessing the Infisical API with the identity

As a prerequisite, you will need to set id-token:write permissions for the GitHub workflow. This setting allows the JWT to be requested from GitHub’s OIDC provider.
To access the Infisical API as the identity, you need to fetch an identity token from GitHub’s identity provider and make a request to the /api/v1/auth/oidc-auth/login endpoint in exchange for an access token. The identity token can be fetched using either of the following approaches:
  • Using environment variables on the runner (ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN).
  • Using getIDToken() from the GitHub Actions toolkit.
Below is an example of how a GitHub workflow can be configured to fetch secrets from Infisical using the Infisical Secrets Action with OIDC Auth.
Preceding steps can then use the secret values injected onto the workflow’s environment.
We recommend using Infisical Secrets Action to authenticate with Infisical using OIDC Auth as it handles the authentication process including the fetching of identity tokens for you.
Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation; the default TTL is 7200 seconds which can be adjusted.If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation.