These pages show Cloud's URLs. Sign in on Dedicated and they show your server's.

Pub from CI

Your CI reads and publishes your private packages with no stored secret. Each job proves which repository it is with its CI provider's own identity token and gets a Pub token that lasts 15 minutes.

BUILDFEX ARCHITECTUREUSERStokensissuesPub tokenpushCI exchangeapps ship to users: app stores, the web, serverssymbolscrashesstack tracessourcetelemetryDeveloper Computerflutter run · dart pub getCIGitHub Actions, GitLab, …Control Roommint tokens · role-based access controlControl Planeorganizations · roles · tokensFEx Pubpackages · sourceObservatorysessions · traces · logsSymbolizercrashes → source linesFEx AIanswers from bothIssue TrackerGitHub · Jira · LinearMobile + Desktop Appsphones · tablets · desktopssends with an OTLP tokenWeb Appsin browserssends with a Browser OTLP tokenDart Serversbackends · servicessends with an OTLP token

How it works

  1. Bind the repository. In the Control Room, open Organization and find CI access. Bind a repository says which repository's CI runs act for your organization, and optionally only from one workflow, environment or branch. An Owner or an Admin binds.
  2. Grant it packages. Each binding is a CI member of your organization. Its Packages button grants it packages to read, or to read and publish, exactly as for a teammate. With no grant it reads the global packages and your organization's engine, if it has one, and publishes nothing. Removing the binding removes the member and everything it was granted.
  3. Exchange in the job. The job requests its identity token for the audience https://fex.flutterrific.io and sends it to the exchange with your organization id, which is on the same Organization screen.
  4. Use the Pub token. dart pub token add hands it to dart pub get and dart pub publish (flutter pub works the same way).

Your CI provider

ProviderBefore you bind
GitHub ActionsGitHub.com is trusted already. For GitHub Enterprise Server, an Owner adds its issuer, https://<your host>/_services/token, as this organization's own.
GitLab CI/CDGitLab.com is trusted already. For a self-managed GitLab, an Owner adds its address, https://<your host>, as this organization's own issuer.
Bitbucket PipelinesEach Bitbucket workspace has its own issuer, so an Owner adds it first: in CI access, under This organization's own CI issuers, choose Bitbucket Pipelines and enter the workspace's URL name.
CircleCIEach CircleCI organization has its own issuer, so an Owner adds it first: in CI access, under This organization's own CI issuers, choose CircleCI and enter the organization ID.

The exchange

The job sends its identity token as a bearer token and your organization id as the body:

shell
curl -sS --fail-with-body -X POST https://api.fex.flutterrific.io/v1/ci/exchange \
  -H "Authorization: Bearer $CI_TOKEN" -H "Content-Type: application/json" \
  -d '{"orgId":"<your organization id>"}'

It answers with the Pub token and what it may do:

json
{
  "token": "dtc_…",                 // the Pub token, valid for 15 minutes
  "keyId": "…",
  "organizationId": "<your organization id>",
  "packages": ["my_package"],       // what it may publish ([] when it only reads)
  "packageAccess": { … },           // what it may read
  "expiresAt": 1767225600           // seconds since 1970
}
  • Each identity token is exchanged once. Exchange once per job, at the start, and keep the Pub token for the job's later steps.
  • The Pub token reads the global packages, your organization's engine if it has one, and every package the CI member is granted, and publishes the ones granted to publish. It cannot do anything else.
  • Every exchange is in your organization's Audit Log, with the repository, the run and the commit.

When the exchange refuses

A refusal names its reason first, so the job's log shows it as is:

json
{"error": {"code": "permission-denied",
  "message": "TRUSTED PUBLISHER REF MISMATCH: …",
  "details": {"reason": "TRUSTED PUBLISHER REF MISMATCH"}}}
ReasonWhat to do
CI EXCHANGE ORG MISSINGThe request named no organization. Send {"orgId": "<your organization id>"} as the body.
CI OIDC TOKEN MISSINGThe request carried no CI token. Send it as Authorization: Bearer <token>.
CI OIDC AUDIENCE INVALIDThe token was requested for another audience. Request it for https://fex.flutterrific.io, as the snippet does.
CI OIDC ISSUER NOT TRUSTEDThe token's issuer is not trusted for this organization. For Bitbucket, CircleCI, GitHub Enterprise Server or a self-managed GitLab, an Owner adds the issuer first.
CI OIDC EXPIREDThe token expired before it was exchanged. Exchange it as soon as the job requests it.
CI OIDC TOKEN REPLAYEDThis token was exchanged already. Each token is exchanged once: exchange once per job.
TRUSTED PUBLISHER NOT BOUNDNo binding of this organization names the job's repository. Bind it in CI access, and check the orgId in the workflow.
TRUSTED PUBLISHER REPOSITORY MISMATCHThe binding names another repository or project. The UUIDs and ids must be the job's own.
TRUSTED PUBLISHER WORKFLOW MISMATCHThe job ran from another workflow or pipeline file than the binding allows.
TRUSTED PUBLISHER ENVIRONMENT MISMATCHThe job did not run in the binding's environment (or, on CircleCI, did not use its context).
TRUSTED PUBLISHER REF MISMATCHThe job ran on a branch or tag the binding's ref pattern does not match.
TRUSTED PUBLISHER REPOSITORY ID MISMATCHThe repository was deleted and created again under the same name. Remove the binding and bind the new repository.
TRUSTED PUBLISHER AMBIGUOUSMore than one binding matches the job. Narrow them (workflow, environment or ref) so exactly one does.
CI OIDC CLAIM MISSINGThe token lacks a claim the provider always sends. Check that the token is the provider's own CI token, requested as the snippet does.
CI OIDC SSH RERUNA CircleCI job rerun with SSH. Run it again without SSH.
CI EXCHANGE RATE LIMITEDToo many exchanges for this repository or organization in a short time. Exchange once per job, then wait and retry.
BOX STATE PUSH FAILEDThe registry did not receive the new token. Retry the job.