# Feature request: easier toggling between accounts using flyctl

**URL:** <https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641>\
**Category:** Phoenix\
**Tags:** wishlist\
**Created:** [June 3, 2021, 5:55pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641 "2021-06-03T17:55:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 3, 2021, 5:55pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/1 "2021-06-03T17:55:25Z")

</div>

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:

```auto
[auth]
  account = "my-account"
  organisation = "my-brand"
```

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [June 3, 2021, 6:08pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/2 "2021-06-03T18:08:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 3, 2021, 6:49pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/3 "2021-06-03T18:49:18Z")

</div>

That would work, if I can simply add my gh user to the business account. I’ll explore.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [June 3, 2021, 6:54pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/4 "2021-06-03T18:54:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 3, 2021, 7:10pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/5 "2021-06-03T19:10:00Z")

</div>

Whole new accounts. My personal and business accounts can’t be reconciled into one, unfortunately.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [June 3, 2021, 7:11pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/6 "2021-06-03T19:11:15Z")

</div>

Ok, let me know if you want us to convert those business accounts to “organizations” and add your user to them.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [June 3, 2021, 7:15pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/7 "2021-06-03T19:15:03Z")

</div>

To answer your original question, one way to handle different logins is to use something like [direnv.net](http://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:

```bash
echo "export FLY_ACCESS_TOKEN=$(fly auth token)" > .envrc

```

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.

---

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 3, 2021, 7:43pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/8 "2021-06-03T19:43:47Z")

</div>

Ah, wonderful! I’m already using direnv! I’ll give that a try. 👍🏻

---

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 4, 2021, 5:48am UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/9 "2021-06-04T05:48:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![OldhamMade](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oldhammade/32/40954_2.png) [@OldhamMade](https://community.fly.io/u/OldhamMade)\
**Post date:** [June 8, 2021, 12:33pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/10 "2021-06-08T12:33:57Z")

</div>

@kurt @jerome Also, something I’ve noticed in all the switching between accounts:

This shows up on the [fly.io](http://fly.io) homepage when I’m logged in:

 ![Screen Shot 2021-06-08 at 14.31.07](https://global.discourse-cdn.com/fly1/original/3X/0/9/093a5cc02dac455a8c17d6b7583062409f460942.png)

And this shows up when I’m logged out (or if I use an incognito window in a different browser):  
 ![Screen Shot 2021-06-08 at 14.31.54](https://global.discourse-cdn.com/fly1/original/3X/b/f/bf0be6614d91ab6494829ebca4658f4e692ff845.png)

This should be the other way around, no? 🙃

---

<div class="post-metadata">

**Author:** ![michael](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/michael/32/16_2.png) [@michael](https://community.fly.io/u/michael)\
**Post date:** [June 8, 2021, 8:09pm UTC](https://community.fly.io/t/feature-request-easier-toggling-between-accounts-using-flyctl/1641/11 "2021-06-08T20:09:46Z")

</div>

Oops! Thanks for letting us know, should be fixed now.
