Conversation
Stage 3 of multi-account support. Commands that call the API take --profile to pick a stored account. auth switch sets the active one, auth list shows them all offline, and logout takes --profile or --all. APIFY_TOKEN still wins, so --profile and auth switch fail while it is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
TL;DR — Adds a way to choose between stored accounts. Commands that call the API take
--profile.apify auth switchsets the active account,apify auth listshows all stored accounts offline, andapify logouttakes--profileor--all.APIFY_TOKENstill has priority, so--profileandauth switchfail while it is set.Stacked on #1458 (base
claude/multi-account-login-1386). Change the base when #1434 → #1450 → #1458 are merged.Closes #1384. Part of #1297.
Change
static enableProfileFlagonApifyCommandadds--profile <name|userId>, the same wayenableJsonFlagadds--json. It is set on 46 commands that call the API:actors,builds,datasets,key-value-stores,runs,task,api,info,run,auth tokenandcreate. It is not oninit,actor *ormcp install.creategets the flag even though the issue calls it offline: with--source github|gitlab|bitbucketit calls the API to set up the Git repository.--profilematches a user ID, thenname ?? username. So profiles migrated from v1 (which havename: null) match by username.InvalidInputand lists the stored accounts.--profilefails withInvalidInputwhenAPIFY_TOKENis set, also when the two tokens are the same. The selection applies to one command only, so telemetry does not change.auth switch [profile]:APIFY_TOKENis set.updateUserId().auth list [--json]: shows name, user ID, personal or organization, last login and storage. It marks the active account and shows a warning whenAPIFY_TOKENoverrides it. It makes no network calls.logout --profile <name>removes that account and keeps the active one.logout --allasks for confirmation first;--yesskips the prompt. Removing an account that is not active keeps the legacy unkeyed keyring entries.The stored API token for my-org was rejected. Run "apify login" to log in to my-org again.A selected account with no token givesNo API token is stored for my-org.The CLI no longer says "not logged in" in that case.infoshowstoken source: --profile flagand aprofilerow.run --profilepasses that account's token and proxy password to the Actor process.docs/regenerated.Verification
pnpm run test:local— 711 passed, 4 skipped (65 files). New filetest/local/commands/auth-profiles.test.tscovers the checks in the issue's Verification list.pnpm run lint,pnpm run format,pnpm run build— clean.pnpm run update-docs— addsauth listandauth switch, and adds--profileto the commands that opt in.node dist/apify.jsby hand with a temporary auth folder that held two profiles. I triedauth list(table and--json), an unknown--profile,APIFY_TOKENwith--profile,auth switchwith no argument from a pipe,APIFY_TOKENwithauth switch,logout --profile, andlogout --allwith and without--yes. All gave the expected output and exit codes.pnpm run test:apinot run: no token in this environment.Left out
APIFY_PROFILEvariable and no profile renaming, as the issue says.auth switchandlogout --profiletake the account as an argument or flag only. There is nolsalias forauth list.🤖 Generated with Claude Code