Skip to content

[eas-cli] Add multi-account support - #3340

Open
brentvatne wants to merge 8 commits into
mainfrom
@brent/multi-account-switcher
Open

brentvatne wants to merge 8 commits into
mainfrom
@brent/multi-account-switcher

Conversation

@brentvatne

@brentvatne brentvatne commented Jan 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add multi-account session management, allowing users to be logged into multiple Expo accounts simultaneously
  • Add account:list command to show all logged-in accounts
  • Add account:switch command to change the active account
  • Update account:login to support adding additional accounts
  • Update account:logout to support logging out specific accounts or all accounts
  • Add global --account flag for per-command account selection

Motivation

I've wanted this for a while since I personally switch between Expo accounts fairly often. I've also heard from other folks who switch between company and personal accounts, or accounts across different projects that their agency manages, that this would be helpful.

Test plan

Set EAS_EXPERIMENTAL_ACCOUNT_SWITCHER=1 in your env, or prefix all of the commands you run with it.

  • eas account:login - login to a new account (adds to existing sessions)
  • eas account:list - shows all logged-in accounts with active indicator
  • eas account:switch - switch between accounts interactively or by name
  • eas account:logout - logout current, specific, or all accounts
  • eas account:view - shows current active account
  • eas <any-command> --account <name> - uses specified account for that command only (works with any command)

@github-actions

github-actions Bot commented Jan 26, 2026 •

Copy link
Copy Markdown

Size Change: +10.6 kB (+0.02%)

Total Size: 53.2 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.2 MB +10.6 kB (+0.02%)

compressed-size-action

@codecov

codecov Bot commented Jan 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.56808% with 283 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.03%. Comparing base (a7436ed) to head (2cac6b3).
⚠️ Report is 125 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/user/SessionManager.ts 57.52% 82 Missing ⚠️
packages/eas-cli/src/commands/account/logout.ts 10.72% 50 Missing ⚠️
packages/eas-cli/src/commands/account/switch.ts 19.61% 41 Missing ⚠️
packages/eas-cli/src/commandUtils/EasCommand.ts 5.56% 34 Missing ⚠️
packages/eas-cli/src/commands/account/list.ts 22.23% 28 Missing ⚠️
packages/eas-cli/src/commands/account/login.ts 10.35% 26 Missing ⚠️
packages/eas-cli/src/commands/account/view.ts 4.35% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3340      +/-   ##
==========================================
- Coverage   64.29%   64.03%   -0.25%     
==========================================
  Files        1047     1049       +2     
  Lines       48332    48728     +396     
  Branches    10194    10296     +102     
==========================================
+ Hits        31068    31200     +132     
- Misses      17148    17412     +264     
  Partials      116      116              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@YashTotale

Copy link
Copy Markdown

@brentvatne This would be a really nice addition. Are there any plans to merge this PR?

Add experimental multi-account support behind EAS_EXPERIMENTAL_ACCOUNT_SWITCHER=1 flag.

SessionManager changes:
- Add v1 schema with accounts object and activeAccountId
- Support storing multiple account sessions
- Add switchAccountAsync/switchAccountByUsernameAsync methods
- Add getAllAccounts, removeAccountAsync, removeAllAccountsAsync
- Maintain backward compatibility with Expo CLI via legacy fields
- Read credentials from active account when multi-account enabled
New commands for multi-account support (hidden when feature flag disabled):
- account:list: Show all logged-in accounts with active indicator
- account:switch: Switch between accounts interactively or by username
- login: Add menu to add account or switch when already logged in
- logout: Add username arg and --all flag for selective logout
- view: Show other logged-in accounts when multi-account enabled
Allow specifying which account to use for any command via --account flag
when multi-account is enabled. Switches to the specified account before
executing the command.
@brentvatne
brentvatne force-pushed the @brent/multi-account-switcher branch from a268fae to 2d694aa Compare August 27, 2026 05:03
@brentvatne
brentvatne requested a review from douglowder August 27, 2026 05:54
@brentvatne
brentvatne marked this pull request as ready for review August 27, 2026 05:54
@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

- Make --account per-command: use an in-memory session override instead of
  persistently switching the active account
- Skip --account interception for commands that define their own account flag
  (project:init, chat, billing:manage, billing:subscribe)
- Support --account=value, reject flag-shaped values, stop at the -- terminator
- Error when --account is combined with EXPO_TOKEN
- Invalidate session secrets on the server in all multi-account logout paths
- Preserve unrelated top-level keys in ~/.expo/state.json on account writes
- Keep the v1 accounts map in sync when logging in or out with the flag off,
  so toggling the flag cannot resurrect a stale identity or drop accounts
- Guard v0->v1 migration against a legacy session with no userId
- Pass the browser flag through the add-account flows; error when logout
  username/--all are used without the feature flag
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@douglowder douglowder added the ai-review Commits pushed to PRs with this label be automatically reviewed. label Sep 18, 2026
@douglowder

Copy link
Copy Markdown
Contributor

@brentvatne if we still need this, let's rebase against current main and I'll go through it carefully.

Copy link
Copy Markdown
Member Author

it'd be nice to have but i think it will take a lot more work to make it actually mergeable, not a priority for me right now

@douglowder

Copy link
Copy Markdown
Contributor

eas-cli now uses changesets for changelogs (#4580). The required "Check for a changeset" check fails on PRs that edit CHANGELOG.md.

To update this PR:

  1. Revert the changes to CHANGELOG.md.
  2. Run yarn changeset, select the changed packages and the bump type, and write the summary.
  3. Commit the new file in .changeset/.

The release adds the PR link and the author to the entry. If this PR needs no changelog entry, revert the CHANGELOG.md changes and add the "no changelog" label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Commits pushed to PRs with this label be automatically reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants