Learn how to authenticate GitLab pipelines with Infisical using OpenID Connect (OIDC).
/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:
/api/v1/auth/oidc-auth/login
endpoint.Creating an identity
https://gitlab.com
. For self-hosted GitLab instances, use the domain of your GitLab instance.project_path:{group}/{project}:ref_type:{type}:ref:{branch_name}
(e.g., project_path:example-group/example-project:ref_type:branch:ref:main
).2592000
equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.2592000
equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.0
): The maximum number of times that an access token can be used; a value of 0
implies infinite number of uses.0.0.0.0/0
, allowing usage from any network address.
subject
, audiences
, and claims
fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible.Adding an identity to a project
Accessing the Infisical API with the identity
id_tokens
property. The resulting token would then be used to login with OIDC like the following: infisical login --method=oidc-auth --oidc-jwt=$GITLAB_TOKEN
Below is a complete example of how a GitLab pipeline can be configured to work with secrets from Infisical using the Infisical CLI with OIDC Auth:id_tokens
keyword is used to request an ID token for the job. In this example, an ID token named INFISICAL_ID_TOKEN
is requested with the audience (aud
) claim set to “infisical-aud-test”. This ID token will be used to authenticate with Infisical.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.