flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

flyctl auth docker -t fails without extra quotes around $FLY_ACCESS_TOKEN

Open arunaugustine opened this issue 1 year ago • 0 comments

Describe the bug When:

  • using flyctl,
  • trying to authenticate Docker for registry push with -t flag,
  • using a valid fly org token set in $FLY_ACCESS_TOKEN

seeing the following behavior:

  1. Without double quotes for env var
fly auth docker -t $FLY_ACCESS_TOKEN
Error: failed authenticating with registry.fly.io: time="2024-05-25T16:30:41+05:30" level=info msg="Error logging in to endpoint, trying next endpoint" error="login attempt to https://registry.fly.io/v2/ failed with status: 401 Unauthorized"
login attempt to https://registry.fly.io/v2/ failed with status: 401 Unauthorized
  1. With double quotes for the env var
bash-3.2$ fly auth docker -t "$FLY_ACCESS_TOKEN"
Authentication successful. You can now tag and push images to registry.fly.io/{your-app}
  • Operating system: MacOS (and also Alpine linux).
  • fly version fly v0.2.55 darwin/arm64 Commit: 0a7df8d78123d5809167cdaa11a78dec92a87e47 BuildDate: 2024-05-16T17:23:50Z

This is possibly due to the fact that the org token has spaces in them, a factor that I realized not before spending lot of time debugging this. Sharing this in the hope that it' saves others some time.

arunaugustine avatar May 25 '24 11:05 arunaugustine