Expand description
PKCE OAuth login for OpenAI Codex.
Guides the user through a browser-based login against auth.openai.com
and returns a Token that can be used as a Bearer token with the
ChatGPT backend API (https://chatgpt.com/backend-api).
§Usage
#[tokio::main]
async fn main() -> Result<(), codex_oauth::Error> {
let token = codex_oauth::login().await?;
println!("{}", token.access_token);
Ok(())
}§Notes
- Requires port 1455 to be free on localhost (hardcoded by OpenAI’s app registration).
CLIENT_IDis hardcoded to OpenAI’s public Codex app registration and is not configurable.
Structs§
- Token
- OAuth token returned after a successful login or refresh.