Skip to main content

Module account_email

Module account_email 

Source
Expand description

The login email of an OAuth provider account, read from the account’s own config dir — SPEC_ACCOUNT_EMAIL_IN_ARMORY_2026_09_23.md §4.

#3541 recorded the email only when the login transcript printed one, and Claude’s login does not, so every Claude account showed its generic name (claude-oauth). The CLI does record who is signed in: Claude writes oauthAccount.emailAddress to .claude.json inside the config dir the account’s SecretRef::OAuthConfigDir points at. Reading it there covers accounts that authenticated before #3541 (the backfill) and follows a re-login as a different user.

Functions§

email_from_oauth_dir
The email the provider CLI recorded in dir, if any. Only Claude writes one today (claude, or its claude-code alias); other providers return None and keep showing their name. The ambient ~/.claude is skipped: a legacy account bound there shares credentials with a terminal claude, whose own config (~/.claude.json) is outside it, so the .claude.json inside may name a user no longer signed in.
identity_key_from_oauth_dir
The Anthropic identity a Claude config dir is signed in as: a short hash of oauthAccount.accountUuid and oauthAccount.organizationUuid (SPEC_RESUME_GATE_AND_SAME_IDENTITY_CONTINUATION_2026_09_25.md §4.1). Not the email: one email can belong to several organizations, a personal one and a Team one, and a session from one isn’t the other’s. Hashed because it goes into a log every srv on the host shares. None on the same terms as email_from_oauth_dir, or when either id is missing.
oauth_account 🔒
oauthAccount from the .claude.json Claude writes into dir.
refresh_account_email
Set account.context.email from its config dir when that differs from what is stored, and return the new email (the caller persists only that field, Store::identity_set_context_email). A different email replaces the stored one — an account re-authenticated as another user must not keep showing the old address (§4). An account whose dir reports no email is left as it is.