You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stage-2: Login - token multi account support #1386
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.
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
Activity
[-]Login - token multi account support[/-][+]Stage-2: Login - token multi account support[/+]feat: auth.json v2 with profiles keyed by user ID (#1434)
feat: key secrets by user ID on both backends (#1450)
feat: make token login additive across accounts (#1458)