Skip to main content

switch_org

Function switch_org 

Source
pub async fn switch_org(
    api_base_override: Option<&str>,
    org_id: &str,
) -> Result<(), String>
Expand description

Switch the active organization silently by minting a fresh token scoped to org_id via the refresh grant’s organization_id override (/connect/token, grant_type=refresh_token). The backend validates membership and stamps active_org=org_id on the new access token — which is what inference reads — so the switch takes effect without a browser re-authorization. Rotated tokens are persisted to the keychain. Also best-effort updates the account’s default org so a future fresh sign-in lands in the same place.