This repository provides a complete, production-ready guide to:
- Authenticate Codex in a remote VS Code (code-server) environment
- Fix common authentication issues
- Organize and manage projects using best practices
Codex uses a localhost OAuth callback (http://localhost:1455) which does not work in web-based VS Code environments.
Authenticate locally (VS Code Desktop) and copy the auth.json file to the container.
- Open VS Code Desktop
- Install and open Codex
- Sign in normally
- Wait for successful authentication
ls ~/.codex/auth.jsonIf not:
mkdir -p ~/.codex
cat > ~/.codex/config.toml <<'EOF'
cli_auth_credentials_store = "file"
EOFThen login again.
scp ~/.codex/auth.json user@SERVER_IP:/home/user/auth.jsondocker exec CONTAINER_NAME mkdir -p /config/.codex
docker cp /home/user/auth.json CONTAINER_NAME:/config/.codex/auth.jsondocker exec CONTAINER_NAME chown abc:abc /config/.codex/auth.json
docker exec CONTAINER_NAME chmod 600 /config/.codex/auth.jsondocker restart CONTAINER_NAMEdocker exec CONTAINER_NAME ls -l /config/.codex/auth.jsonExpected:
-rw------- 1 abc abc ...
- Reload window
- Open Codex
It should be authenticated automatically.
Check:
echo $HOMEShould be:
/config
Verify:
ls /config/.codex/auth.json/config/workspace/
workspace/
├── affiliates/
├── automation/
├── bots/
├── scraping/
├── experiments/
cd /config/workspace
mkdir my-project
cd my-project
code .cd /config/workspace
git clone https://github.com/user/repo.git
cd repo
code .git clone https://TOKEN@github.com/user/repo.gitcd /config/workspace && git clone REPO_URL && cd repo && code .Ensure /config is a persistent volume in EasyPanel.
Backup auth:
cp /config/.codex/auth.json /home/user/auth_backup.json- Always use
/config/workspace - One project per folder
- Use clear naming
- Version everything with Git
- Fully working Codex in VS Code Web
- Persistent environment
- Scalable project structure
- Reproducible setup
Apache License 2.0