run_browser_login(
interaction: CodexLoginInteraction | None = None,
*,
store_path: Path | None | Name | Type | Description |
|---|---|---|
interaction | CodexLoginInteraction | None | Default: NoneUI hooks for surfacing the URL / notices. A default
stdout-based implementation is used when |
store_path | Path | None | Default: NoneOverride the token store path. Defaults to
|
open_browser | bool | Default: True |
cancel_event | threading.Event | None | Default: None |
Run the ChatGPT OAuth Authorization Code Flow with PKCE.
Reimplements the upstream langchain_openai.chatgpt_oauth browser
sign-in flow over its lower-level helpers, but routes the authorize-URL
display through interaction so a Textual screen can render it inline.
The blocking callback wait and the synchronous token exchange both run
inside asyncio.to_thread so the calling event loop stays responsive.
_wait_for_oauth_callback raises TimeoutError after 300s of
inactivity; that exception propagates unchanged.
Whether to call webbrowser.open. Disable in
headless environments or tests.
Optional event the caller can set to abandon the
wait. Polled between callback server requests by
_wait_for_oauth_callback, so setting it stops the wait and
closes the loopback server within one poll interval (~1s),
freeing the port for an immediate retry.