Exchange an OIDC Token for JFrog Access
Exchange an OIDC token for a JFrog access token using jf eot in CI/CD pipelines.
The jf exchange-oidc-token command (jf eot) exchanges an OpenID Connect (OIDC) token ID from your continuous integration (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 continuous integration and delivery (CI/CD) pipelines. OIDC tokens are short-lived credentials generated inside a CI job. You cannot create them locally.
Prerequisites
- Your JFrog Platform administrator must configure the OIDC integration. See Administration > Security > OpenID Connect in the Artifactory UI.
- Your CI/CD platform must support OIDC identity federation (GitHub Actions, Azure DevOps, or a generic OIDC-compatible provider).
- 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=<PLATFORM_URL>] [--oidc-provider-type=<TYPE>]Where:
<OIDC_PROVIDER_NAME>: Name of the OIDC provider configured in Artifactory (first positional, required). Pass the provider name as this argument. The--oidc-provider-nameflag is not used to supply it forjf exchange-oidc-token.<OIDC_TOKEN_ID>: OIDC token to exchange, usually as the second positional argument. It can be omitted if you pass the same value with--oidc-token-idor setJFROG_CLI_OIDC_EXCHANGE_TOKEN_ID.<PLATFORM_URL>: Optional. JFrog Platform base URL. Defaults to the URL from the default server configuration (seejf config use) if omitted.<TYPE>: Optional. Provider implementation:GitHub(default),Azure, orGenericOidc.- You can add further flags from the Options table (
--oidc-audience,--application-key,--project,--repository, and others) as needed.
Aliases: jf eot
Arguments
The following table lists command arguments.
| Argument | Required | Description |
|---|---|---|
<OIDC_PROVIDER_NAME> | Yes | Name of the OIDC provider (first positional) |
<OIDC_TOKEN_ID> | No | Second positional, or use --oidc-token-id or JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID |
Options
The following table lists command options.
| Flag | Short | Default | Description |
|---|---|---|---|
--url | — | — | JFrog Platform base URL (example: https://acme.jfrog.io/). If omitted, uses the default configured server (see jf config use). |
--oidc-audience | — | — | Audience for the OIDC token |
--oidc-token-id | — | — | Optional alternative to the second positional token argument (same as JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID) |
--oidc-provider-type | — | GitHub | OIDC provider type: GitHub, Azure, or GenericOidc |
--application-key | — | — | JFrog Application Key. Required when the JFrog Platform uses application-scoped OIDC configurations. |
--project | — | — | JFrog Artifactory project key |
--repository | — | — | Repository name to filter the OIDC resource scope |
--format | — | json | Output format. Available from JFrog CLI 2.105.0. Accepts json or table. Defaults to json for backward compatibility. Passing --format with no value after the provider name and token ID returns [Error] only the following output formats are supported: json, table; the same message appears for an unsupported value (for example, --format=yaml). |
Environment Variables
The following table lists the related environment variable.
| Variable | Description |
|---|---|
JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID | OIDC 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. Use --format to control the output format.
--format json (default)
--format json (default){
"access_token": "<ACCESS_TOKEN>",
"username": "[email protected]",
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token",
"scope": "applied-permissions/user",
"token_type": "Bearer"
}--format table
--format tableFIELD VALUE
access_token <ACCESS_TOKEN>
username [email protected]
issued_token_type urn:ietf:params:oauth:token-type:access_token
scope applied-permissions/user
token_type BearerUse 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=<PLATFORM_URL>Where:
<OIDC_PROVIDER_NAME>and<OIDC_TOKEN_ID>: Values from your OIDC setup and CI job.<PLATFORM_URL>: For examplehttps://acme.jfrog.io/.
Example:
jf eot my-github-provider <OIDC_TOKEN_ID> --url=https://acme.jfrog.io/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=<PLATFORM_URL>Where:
<TYPE>:GitHub,Azure, orGenericOidc.
Example:
jf eot my-oidc-provider <OIDC_TOKEN_ID> --oidc-provider-type=Azure --url=https://acme.jfrog.io/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/ \
--oidc-provider-type=GitHubUse Environment Variable for Token ID
To pass the token ID via environment variable:
- Run:
export JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID=<OIDC_TOKEN_ID>
jf eot <OIDC_PROVIDER_NAME> --url=https://<PLATFORM_HOST>/Where:
<OIDC_TOKEN_ID>: OIDC token value for the current job.<OIDC_PROVIDER_NAME>: Configured provider name.<PLATFORM_HOST>: Your JFrog Platform host (for exampleacme.jfrog.io).
Example:
export JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID=<OIDC_TOKEN_ID>
jf eot my-oidc-provider --url=https://acme.jfrog.io/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 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
GenericOidctype.
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. This is one of several authentication methods the JFrog CLI supports.
Note
OIDC is an identity protocol built on top of OAuth 2.0. For setup requirements, see Prerequisites.
Troubleshooting
Match your symptom to the following table to fix common jf exchange-oidc-token errors.
| Error | Cause | Resolution |
|---|---|---|
server response: 401 Authentication is required | Invalid or expired OIDC token, or provider name mismatch | Verify 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 Found | Incorrect --url value | Confirm the Artifactory URL is correct and reachable. |
unsupported oidc provider type: <value> | Invalid value for --oidc-provider-type | Use one of GitHub, Azure, or GenericOidc. |
Wrong number of arguments (0) | No positional arguments provided | At least <OIDC_PROVIDER_NAME> is required (first positional). The token can be the second positional, or --oidc-token-id, or JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID. |
Frequently Asked Questions
This section provides answers to frequently asked questions.
FAQs
Q: What do I need before I can use jf exchange-oidc-token?
jf exchange-oidc-token?A: Your JFrog Platform administrator must configure the OIDC integration, and your CI/CD platform must support OIDC identity federation (GitHub Actions, Azure DevOps, or a generic OIDC-compatible provider). See Prerequisites.
Q: Can I generate an OIDC token to test this command locally?
A: No. OIDC tokens are short-lived credentials generated inside a CI job by your CI/CD platform's identity provider; they cannot be created locally. See the Note under Synopsis.
Q: How do I provide the OIDC token ID without passing it as a positional argument?
A: Use --oidc-token-id, or set the JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID environment variable so the <OIDC_TOKEN_ID> positional argument can be omitted. See Environment Variables.
Q: Which OIDC provider types are supported?
A: GitHub (the default), Azure, or GenericOidc, set with --oidc-provider-type. See Options.
Q: What does Wrong number of arguments (0) mean?
Wrong number of arguments (0) mean?A: No positional arguments were provided. At least <OIDC_PROVIDER_NAME> is required as the first positional argument. See Troubleshooting.
Related Topics
Updated 2 days ago
What’s Next
After obtaining a token, add a server configuration to store it.
