Skip to content

Stage-2: Login - token multi account support #1386

Closed

Description

@l2ysho

Note

TL;DR — After Stage-1 the storage can hold many accounts, but nothing puts a second one there. apify login still replaces. This makes login additive: each login adds or updates a profile keyed by user ID, and the new account becomes active. Selecting between accounts arrives in Stage-3, so logout acts on the active profile and then switches to the one that remains.

Part of #1297. Depends on Stage-1 (#1383).

Scope

  • apify login --token <t> adds a profile, or updates it in place when that account is already stored. Keyed by userId, so no duplicates.
  • The account you just logged in to becomes the active profile.
  • The profile name comes from the token — the username returned by user('me'). No naming flag here.
  • loggedInAt is set on every successful login, including a repeat login to an account already stored.
  • logout logs out the active profile. If other profiles remain, the one with the most recent loggedInAt becomes active. If none remain, the CLI is logged out.
  • Login and logout messages name the account, and say which profile is active afterwards.

Not in scope

--profile, apify auth switch, apify auth list, and logout --profile / --all are Stage-3 (#1384). Until then a second account is reachable only by logging in to it again.

Console browser login

login -m console shares tryToLogin, so it becomes additive on its own. No work goes into it, and no new tests. It is deprecated by the device flow in #1328, and #1203 goes away with it.

Assumption

Platform usernames are unique, so a profile name cannot collide with a different userId.

Verification

  • log in to two accounts → two profiles, the second one active
  • log in again to the first → updated in place, no duplicate, it becomes active
  • logout with two profiles → the other becomes active, and the message says so
  • logout with one profile → logged out
  • a user with one account sees no change from today
  • migrate a v1 file, then log in to a second account

🤖 Generated with Claude Code

Activity

  1. changed the title [-]Login - token multi account support[/-] [+]Stage-2: Login - token multi account support[/+] on Sep 3, 2026
  2. added a commit that references this issue on Oct 8, 2026
    4708c1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-buildersIssues owned by the Builders team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions