Skip to main content

Crate codex_oauth

Crate codex_oauth 

Source
Expand description

PKCE OAuth login for OpenAI Codex.

Thin wrapper around motosan_ai_oauth with the Codex provider pre-configured.

§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_ID is hardcoded to OpenAI’s public Codex app registration and is not configurable.

Structs§

Token

Enums§

Error

Functions§

login
Open a browser-based PKCE login flow and return the resulting OAuth token.
refresh
Exchange a stored refresh token for a new Token.