mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
Allow provider selection for gateway OAuth reads and logins (#59819)
## Why Gateway OAuth reads and logins previously used only the current provider, preventing clients from authorizing another configured provider without changing the default. ## What changed - Add optional `modelProvider` params to `account/gatewayOAuth/read` and `account/gatewayOAuth/login`, preserving current-provider behavior for omitted or null params and selectors. - Validate explicit providers against current managed policy without changing the default or any thread's provider. - Retain readiness state across providers and send `account/gatewayOAuth/changed` notifications for every configured provider sharing the changed credential. - Update protocol schemas, TypeScript types, Python models, and documentation. ## Testing Add coverage for non-default provider login, retained readiness when alternating providers, notifications for shared credentials without starting login, and legacy TypeScript request compatibility. GitOrigin-RevId: cfd472c322b821fe36b8c133a8de774f4ba48534
This commit is contained in:
@@ -652,6 +652,30 @@ impl std::fmt::Debug for GatewayOAuthChangedNotification {
|
||||
}
|
||||
}
|
||||
|
||||
/// Read credential readiness for a configured provider without starting browser login.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct GatewayOAuthReadParams {
|
||||
/// Defaults to the current provider when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
pub model_provider: Option<String>,
|
||||
}
|
||||
|
||||
pub type NullableGatewayOAuthReadParams = Option<GatewayOAuthReadParams>;
|
||||
|
||||
/// Authorize a configured provider without changing the default or any thread's provider.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct GatewayOAuthLoginParams {
|
||||
/// Defaults to the current provider when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
pub model_provider: Option<String>,
|
||||
}
|
||||
|
||||
pub type NullableGatewayOAuthLoginParams = Option<GatewayOAuthLoginParams>;
|
||||
|
||||
/// Current effective gateway policy and credential readiness; never contains credentials.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
Reference in New Issue
Block a user