As mentioned in another thread, I have a few different (Elixir/Phoenix) projects that I’m migrating over to fly, some on my personal account, some for my employer.
Because I have to work across multiple accounts, I have to keep logging out/in to switch between them. It is not a great workflow.
It would be great if flyctl could authenticate into multiple accounts, and then use the account (and org) that was assigned in the fly.toml in the project. Eg:
This is not obvious, but we designed Fly so that you’d have a single user account and add it to multiple organizations (similar to GitHub). Will just adding your primary user to the other orgs work for what you need?
Did you make business organizations in Fly, or signup for whole new accounts? If you made new organizations, you can invite your primary user. If you didn’t, we can help you get those reconciled. Just send me a DM with your primary user and the accounts you made specifically.
To answer your original question, one way to handle different logins is to use something like direnv.net to set the right FLY_ACCESS_TOKEN environment variable for your project directories. When you’re logged in, you can run fly auth token.
Assuming you in a directory for a particular app, you can run something like this:
If you group your projects into directories by business, you should be able to add a single .envrc for each “business” and have the project directories inherit that.
Unfortunately it looks like I can’t invite myself (personal email) to my employer’s account. The invite is sent but the accept fails.
I still think it would be preferable in a number of cases for flyctl to be the place to manage auth between accounts. For example, in a case where a web agency needs to have access to multiple client-owned accounts, along with their own account split into orgs for clients who don’t need direct access to fly.