mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Enable configuration server OAuth during app-server startup (#62867)
## Why When an organization's configuration server requires a new OAuth grant, clients need a way to sign in before the app server starts so they can load and validate the required settings. ## What changed - Have `--print-startup-config` return the `configServerLogin` action when browser sign-in is required, and verify that the required server settings were applied before returning startup requirements. - Add `codex app-server --startup-oauth`, a dedicated stdio mode that resolves the configuration server from local managed requirements, sends the client a browser authorization URL, and handles the callback, token exchange, and credential storage. Clients can cancel a pending sign-in or rerun `--print-startup-config` after it succeeds. ## Testing Add a test that checks the browser handoff URL and verifies that cancellation completes the pending login request with `LoginFailed`. GitOrigin-RevId: 00f10d28befe33539882f4f3c0d2baf868ceb4a1
This commit is contained in:
committed by
copyberry
parent
f342aa7b92
commit
cf8992e940
@@ -175,6 +175,7 @@ pub struct CloudConfigBundleLoadError {
|
||||
code: CloudConfigBundleLoadErrorCode,
|
||||
message: String,
|
||||
status_code: Option<u16>,
|
||||
login_required: bool,
|
||||
}
|
||||
|
||||
impl CloudConfigBundleLoadError {
|
||||
@@ -187,9 +188,26 @@ impl CloudConfigBundleLoadError {
|
||||
code,
|
||||
message: message.into(),
|
||||
status_code,
|
||||
login_required: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn login_required(message: impl Into<String>) -> Self {
|
||||
Self {
|
||||
login_required: true,
|
||||
..Self::new(
|
||||
CloudConfigBundleLoadErrorCode::Auth,
|
||||
/*status_code*/ None,
|
||||
message,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn requires_login(&self) -> bool {
|
||||
self.login_required
|
||||
|| (self.code == CloudConfigBundleLoadErrorCode::Auth && self.status_code == Some(401))
|
||||
}
|
||||
|
||||
pub fn code(&self) -> CloudConfigBundleLoadErrorCode {
|
||||
self.code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user