Fly.io "No access token available" (FLY_API_TOKEN) in CI
flyctl authenticates non-interactively with FLY_API_TOKEN. When it is unset, flyctl reports it has no access token and points you at flyctl auth login, which cannot run in CI.
What this error means
A flyctl deploy step fails with "Error: no access token available. Run flyctl auth login to obtain one".
Error: no access token available. Run `flyctl auth login` to obtain oneCommon causes
No token in the environment
CI cannot run interactive flyctl auth login, so without FLY_API_TOKEN flyctl has no credential.
The token secret was not exposed to the step
The secret exists but was not mapped into the job env, so flyctl sees no token.
How to fix it
Set FLY_API_TOKEN from a secret
- Create a deploy token with
flyctl tokens create deploy. - Store it as a CI secret named
FLY_API_TOKEN. - Expose it to the deploy step (flyctl reads it automatically).
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}Use a scoped deploy token
A deploy token is scoped to one app, which is safer for CI than a full account token.
flyctl tokens create deploy -a my-appHow to prevent it
- Use an app-scoped deploy token for CI.
- Keep
FLY_API_TOKENin CI secrets. - Set it at the job level so all flyctl calls are authenticated.