Exchange an OIDC token for JFrog access

The jf exchange-oidc-token command (jf eot) swaps an OIDC token ID from your CI identity provider for a JFrog access token and username. It is intended for pipelines where short-lived OIDC credentials are issued inside the job.

πŸ“˜

Note

: This command is designed for CI/CD pipelines. OIDC tokens are short-lived credentials generated inside a CI job β€” they cannot be created locally.

Prerequisites

To use this command:

  1. Your JFrog Platform administrator must configure the OIDC integration. See Administration > Security > OpenID Connect in the Artifactory UI.
  2. Your CI/CD platform must support OpenID Connect (OIDC) identity federation (GitHub Actions, Azure DevOps, or a generic OIDC-compatible provider).
  3. The JFrog CLI must be installed and accessible in your CI/CD environment.

Synopsis

jf exchange-oidc-token <oidc-provider-name> <oidc-token-id> [--url=<artifactory-url>] [--oidc-provider-type=<type>]

Where:

  • <oidc-provider-name> β€” Name of the OIDC provider configured in Artifactory.
  • <oidc-token-id> β€” OIDC token ID to exchange (omit if JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID is set).
  • <artifactory-url> β€” Optional. Artifactory base URL; defaults to the configured server if omitted.
  • <type> β€” Optional. Provider implementation: GitHub (default), Azure, or GenericOidc.
  • You can add further flags from the Options table (--oidc-audience, --application-key, --project, --repository, and others) as needed.

Aliases: jf eot

Arguments

ArgumentRequiredDescription
<oidc-provider-name>YesName of the OIDC provider
<oidc-token-id>YesOIDC token ID to exchange for an access token

Options

FlagShortDefaultDescription
--urlβ€”β€”JFrog Artifactory URL (example: https://acme.jfrog.io/artifactory). If omitted, uses the default configured server (see jf config use).
--oidc-audienceβ€”β€”Audience for the OIDC token
--oidc-provider-nameβ€”β€”OIDC provider name. Must be used together with the <oidc-provider-name> positional argument; does not replace it.
--oidc-token-idβ€”β€”OIDC token ID. Must be used together with the <oidc-token-id> positional argument; does not replace it.
--oidc-provider-typeβ€”GitHubOIDC provider type: GitHub, Azure, or GenericOidc
--application-keyβ€”β€”JFrog Application Key. Required when your JFrog Platform uses application-scoped OIDC configurations.
--projectβ€”β€”JFrog Artifactory project key
--repositoryβ€”β€”Repository name to filter the OIDC resource scope

Environment Variables

VariableDescription
JFROG_CLI_OIDC_EXCHANGE_TOKEN_IDOIDC token ID. When set, the <oidc-token-id> positional argument can be omitted.

Output

On success, the command prints the JFrog access token and the associated username:

{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
  "username": "[email protected]"
}

Use the returned access_token with jf config add to store the credential for subsequent commands.

Examples

Exchange an OIDC Token

To exchange a provider token for a JFrog access token:

jf eot <oidc-provider-name> <oidc-token-id> --url=<artifactory-url>

Where:

  • <oidc-provider-name> and <oidc-token-id> β€” Values from your OIDC setup and CI job.
  • <artifactory-url> β€” For example https://acme.jfrog.io/artifactory.

Example:

jf eot my-github-provider eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... --url=https://acme.jfrog.io/artifactory

The command prints a JFrog access token and username (see Output).

Use a Non-Default Provider Type

To specify a non-GitHub OIDC provider type:

jf eot <oidc-provider-name> <oidc-token-id> --oidc-provider-type=<type> --url=<artifactory-url>

Where:

  • <type> β€” GitHub, Azure, or GenericOidc.

Example:

jf eot my-oidc-provider eyJhbGciOiJIUzI1NiIs... --oidc-provider-type=Azure --url=https://acme.jfrog.io/artifactory

GitHub Actions Workflow

To exchange an OIDC token from GitHub Actions:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      id-token: write   # required to generate an OIDC token
      contents: read
    steps:
      - name: Get OIDC token
        id: oidc
        run: |
          TOKEN=$(curl -sS "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" \
            -H "Authorization: Bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" | jq -r .value)
          echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"

      - name: Exchange OIDC token for JFrog access token
        run: |
          jf eot my-github-oidc-provider "${{ steps.oidc.outputs.TOKEN }}" \
            --url=https://<your-org>.jfrog.io/artifactory \
            --oidc-provider-type=GitHub

Use Environment Variable for Token ID

To pass the token ID via environment variable:

  1. Run:
export JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID=<oidc-token-id>
jf eot <oidc-provider-name> --url=https://<artifactory-host>/artifactory

Where:

  • <oidc-token-id> β€” OIDC token value for the current job.
  • <oidc-provider-name> β€” Configured provider name.
  • <artifactory-host> β€” Your JFrog hostname (for example acme.jfrog.io).

Example:

export JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID=eyJhbGciOiJIUzI1NiIs...
jf eot my-oidc-provider --url=https://acme.jfrog.io/artifactory

When JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID is set, the <oidc-token-id> positional argument can be omitted.

When to Use

Use jf eot (exchange OIDC token) when your CI/CD platform supports OpenID Connect (OIDC) identity federation with JFrog. This is the recommended authentication method for:

  • GitHub Actions: Uses GitHub's built-in OIDC provider to generate short-lived tokens
  • Azure DevOps: Uses Azure AD as the OIDC provider
  • Other OIDC providers: Any provider compatible with the GenericOidc type

OIDC eliminates the need to store long-lived access tokens as CI/CD secrets. Instead, the CI platform generates a short-lived identity token that the CLI exchanges for a JFrog access token.

πŸ“˜

Note

: OIDC (OpenID Connect) is an identity protocol built on top of OAuth 2.0. See the Prerequisites section for setup requirements.

Troubleshooting

To fix common jf exchange-oidc-token errors:

ErrorCauseResolution
server response: 401 Authentication is requiredInvalid or expired OIDC token, or provider name mismatchVerify the provider name matches the one configured in Artifactory. Ensure the OIDC token was generated in the current CI job and has not expired.
server response: 404 Not FoundIncorrect --url valueConfirm the Artifactory URL is correct and reachable.
unsupported oidc provider type: <value>Invalid value for --oidc-provider-typeUse one of: GitHub, Azure, GenericOidc.
Wrong number of arguments (0)No positional arguments providedThe two positional arguments <oidc-provider-name> and <oidc-token-id> are required. The --oidc-provider-name and --oidc-token-id flags do not replace them.


What’s Next

After obtaining a token, add a server configuration to store it.