{"repo":"pedrobrantes/codex-get-auth-conf","free":true,"listed":false,"github":"https://github.com/pedrobrantes/codex-get-auth-conf","clone":"git clone https://github.com/pedrobrantes/codex-get-auth-conf.git","description":"Utility to get auth.json and OPENAI_API_KEY for OpenAI codex-cli","language":"TypeScript","stars":15,"topics":["auth","cli","codex","openai","oauth2","authentication"],"license":null,"category":"auth-billing-email","readme_excerpt":"Codex Get Auth Conf (auth.json) A standalone Node.js script to programmatically obtain an OpenAI API key by replicating the authentiation flow of the codex CLI. This project is the result of a deep dive into reverse-engineering a real-world OAuth 2.0 PKCE authentication flow. 🚀 Features - Automated Browser Login : Initiates the OpenAI login flow directly in your default browser. - Secure OAuth 2.0 PKCE Flow : Correctly implements the Proof Key for Code Exchange (PKCE) for secure authorization. - Local Callback Server : Runs a temporary local server to handle the OAuth redirect and capture the authorization code. - Automatic Token Exchange : Exchanges the temporary code for a final, long-lived API key. - Credential Storage : Saves the obtained tokens and API key to /.codex/auth.json , mimicking the official CLI's behavior. 🤔 Why This Project Exists This project began as an exploration to understand how modern CLI tools handle secure user authentication without asking the user to manually paste API keys. By reverse-engineering the codex CLI's login process, we can observe a complete, production-grade implementation of the OAuth 2.0 Authorization Code Grant with PKCE. It serves as a practical learning tool for anyone interested in API security and application authentication. 📋 Prerequisites - Node.js (v18.x or later recommended) - npm ⚙️ Installation & Usage Run with npx: --- You can install this tool globally via npm: --- 1. Clone the repository: 2. Navigate to the project d","default_branch":null,"files":null,"tree":[],"storefront":"/r/pedrobrantes","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/pedrobrantes/codex-get-auth-conf/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}