Skip to main content

set_slot_identity

Function set_slot_identity 

Source
pub fn set_slot_identity(
    cred: &CredentialRef,
    account_id: &str,
    identity: Option<&str>,
) -> Result<(), String>
Expand description

Record the provider seat identity on an EXISTING OAuth slot: sets accountId (the full provider account id) and, when given, the display identity. Used by the auth identify backfill for slots whose login predates identity acquisition (Anthropic tokens are opaque; the seat comes from the profile endpoint after the fact).

Touches no other field — a refresh/access rotated by another process between the caller’s read and this write is never clobbered, because the write happens under the store lock and only inserts the two identity keys into the entry read under that same lock. A missing slot, a non-OAuth entry, or an empty account_id is an error and writes nothing.

Profiles: like remove_credential, this refuses to act on an auth.json the active profile merely inherits.