ms-teams-cli icon indicating copy to clipboard operation
ms-teams-cli copied to clipboard

auth list should show which user each profile is signed in as

Open aberoham opened this issue 3 months ago • 0 comments

Problem

teams auth list prints only profile names:

{ "profiles": ["default", "alt"], "active": "default" }

With more than one profile there is no way to tell which account each profile holds without running auth status once per profile. The information is already available locally: the stored access token's claims contain the user principal name and tenant ID, and auth status already decodes them.

Fix

For each profile in the index, load its token from the keyring and decode the claims (no network calls):

{
  "profiles": [
    { "name": "default", "user": "[email protected]", "tenant_id": "...", "expires_at": "..." },
    { "name": "alt", "user": "[email protected]", "tenant_id": "...", "expires_at": "..." }
  ],
  "active": "default"
}

Profiles whose token cannot be read or decoded should still be listed, with the extra fields null, so a broken keyring entry does not hide the profile.

Note

On macOS this reads one keychain item per profile, so it can trigger one permission prompt per profile until the store_token delete-before-write bug (#51) is fixed. Ship this after #51.

aberoham avatar Aug 15 '26 10:08 aberoham