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
wk auth login rejects a legitimate new profile if another existing profile's introspected workspace happens to share the same display name, even when the two tokens belong to genuinely different workspaces (different numeric workspace IDs).
Profile.Workspace is populated from info.Name (the human-readable name returned by GET /users/me), while Profile.WorkspaceID holds the actual numeric account ID (see internal/commands/auth.go:229-230). The duplicate check compares the display-name string instead of WorkspaceID.
Repro
Have two Workato trial workspaces both associated with the same account display name (e.g. "Zayne Turner") — this happens naturally when a user creates multiple trial/sandbox workspaces under one email.
Register the first as profile academy via wk auth login (env dev_sbx, region trial). Confirmed via GET /users/me this token's workspace ID is 2100005003.
Attempt to register a second, unrelated workspace (workspace ID 2100000735, confirmed via GET /users/me on that token) as a new profile:
Error: saving profile: a profile already targets this workspace/environment/region combination: profile "academy" already targets Zayne Turner/dev_sbx (trial)
--force does not bypass this (per --help, --force only skips the overwrite confirmation for a same-named profile, not this cross-profile collision check) — so there's no workaround via flags. The only way to register the second profile is to fall back to a profiles.env file-store profile instead of wk auth login.
Expected
The duplicate-target check should compare WorkspaceID (or another stable identifier), not the mutable/collidable display name, so two distinct workspaces that happen to share a display name can both be registered.
Notes
Pre-existing on develop (introduced in a4a1a53), not part of PR Zt/api gap closure #93 — found incidentally while smoke-testing Zt/api gap closure #93 against the dev-kit-testing project.
Profile.WorkspaceID already exists and is populated at login time, so the fix is likely just swapping the comparison field in hasDuplicateTarget.
Summary
wk auth loginrejects a legitimate new profile if another existing profile's introspected workspace happens to share the same display name, even when the two tokens belong to genuinely different workspaces (different numeric workspace IDs).Where
internal/auth/profile.go:26(hasDuplicateTarget):Profile.Workspaceis populated frominfo.Name(the human-readable name returned byGET /users/me), whileProfile.WorkspaceIDholds the actual numeric account ID (seeinternal/commands/auth.go:229-230). The duplicate check compares the display-name string instead ofWorkspaceID.Repro
academyviawk auth login(envdev_sbx, regiontrial). Confirmed viaGET /users/methis token's workspace ID is2100005003.2100000735, confirmed viaGET /users/meon that token) as a new profile:Actual
--forcedoes not bypass this (per--help,--forceonly skips the overwrite confirmation for a same-named profile, not this cross-profile collision check) — so there's no workaround via flags. The only way to register the second profile is to fall back to aprofiles.envfile-store profile instead ofwk auth login.Expected
The duplicate-target check should compare
WorkspaceID(or another stable identifier), not the mutable/collidable display name, so two distinct workspaces that happen to share a display name can both be registered.Notes
develop(introduced ina4a1a53), not part of PR Zt/api gap closure #93 — found incidentally while smoke-testing Zt/api gap closure #93 against thedev-kit-testingproject.Profile.WorkspaceIDalready exists and is populated at login time, so the fix is likely just swapping the comparison field inhasDuplicateTarget.