Added MCP server command to enable authentication using ChatGPT (#2373)
This PR adds two new APIs for the MCP server: 1) loginChatGpt, and 2) cancelLoginChatGpt. The first starts a login server and returns a local URL that allows for browser-based authentication, and the second provides a way to cancel the login attempt. If the login attempt succeeds, a notification (in the form of an event) is sent to a subscriber. I also added a timeout mechanism for the existing login server. The loginChatGpt code path uses a 10-minute timeout by default, so if the user fails to complete the login flow in that timeframe, the login server automatically shuts down. I tested the timeout code by manually setting the timeout to a much lower number and confirming that it works as expected when used e2e.
This commit is contained in:
@@ -100,6 +100,7 @@ fn end_to_end_login_flow_persists_auth_json() {
|
||||
port: 0,
|
||||
open_browser: false,
|
||||
force_state: Some(state),
|
||||
login_timeout: None,
|
||||
};
|
||||
let server = run_login_server(opts, None).unwrap();
|
||||
let login_port = server.actual_port;
|
||||
@@ -158,6 +159,7 @@ fn creates_missing_codex_home_dir() {
|
||||
port: 0,
|
||||
open_browser: false,
|
||||
force_state: Some(state),
|
||||
login_timeout: None,
|
||||
};
|
||||
let server = run_login_server(opts, None).unwrap();
|
||||
let login_port = server.actual_port;
|
||||
|
||||
Reference in New Issue
Block a user