Skip to content

Commit fa5508d

Browse files
authored
Merge pull request #353 from rubygems/segiddins/document-trusted-publisher-api
Document the trusted publisher exchange token API
2 parents 67c16af + d5a01fd commit fa5508d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rubygems-org-api.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,24 @@ Retrieve your API key using HTTP basic auth.
556556
"rubygems_api_key": "701243f217cdf23b1370c7b66b65ca97"
557557
}
558558

559+
### POST - `/api/v1/oidc/trusted_publisher/exchange_token`
560+
561+
Exchange an OIDC ID token for a RubyGems API key. This endpoint is intended to be used by the
562+
[`release-gem`](github.com/rubygems/release-gem) GitHub Action for [trusted publishing](/trusted-publishing/releasing-gems).
563+
564+
The request body must be a JSON object with a single key, `jwt`, whose value is the ID token (as a string).
565+
566+
$ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" \
567+
-d '{"jwt": $ID_TOKEN}' \
568+
https://rubygems.org/api/v1/oidc/trusted_publisher/exchange_token"
569+
570+
{
571+
"rubygems_api_key": "rubygems_701243f217cdf23b1370c7b66b65ca97",
572+
"name": "GitHub Actions rubygems/configure-rubygems-credentials @ .github/workflows/token.yml",
573+
"scopes": ["push_rubygem"],
574+
"expires_at": "2021-01-01T00:00:00Z"
575+
}
576+
559577
### GET - `/api/v1/dependencies?gems=[COMMA DELIMITED GEM NAMES]`
560578

561579
Returns a marshalled array of hashes for all versions of given gems. Each hash

0 commit comments

Comments
 (0)