π§© Codex Skill β Refresh your Codex CLI auth.json from a local ChatGPT web session. Essential for Codex users behind firewalls, in WSL/containers, or on remo...
---
name: codex-auth
description: π§© Codex Skill β Refresh your Codex CLI auth.json from a local ChatGPT web session. Essential for Codex users behind firewalls, in WSL/containers, or on remote desktops.
tags:
- codex
- codex-cli
- auth
- chatgpt
- token
- windows
- playwright
---
# π§© Codex Skill: Codex Auth Session Refresh
> **This is an [OpenClaw skill](https://clawhub.com/skill/codex-auth-session) for [Codex CLI](https://github.com/openai/codex).**
> It provides Windows tooling to refresh Codex's `auth.json` with a fresh ChatGPT session token.
**ι©η¨ζΌ Codex Β· For Codex CLI users**
---
## π― Who Is This For?
**Codex CLI users** who are stuck with any of these:
| π€ Pain | π₯ Why it sucks |
|---------|----------------|
| Codex OAuth won't complete | Proxies, WSL, containers β browser never opens |
| OpenAI 2FA every time | Token expires every few hours |
| Forced to use API proxies | Can't get official auth working, settle for third-party |
| Token dies mid-session | Lose context, workflow destroyed |
## What This Does
Extracts a fresh `access_token` from your existing ChatGPT browser session and writes it directly to Codex's `~/.codex/auth.json`. No reverse engineering. No MITM. No API abuse.
**ιη¨δΊ Codex CLIοΌCodex θ΅°δΈδΊ OAuth ζΆηζζγ**
## Quick Install (on Windows)
```powershell
git clone https://github.com/zcz-user/codex-auth-session-refresh.git
cd codex-auth-session-refresh
npm install
.\login-profile.ps1 # Login ChatGPT β press Enter
.\status.ps1 # Check Codex auth state
```
Then Codex will see the fresh token in `~/.codex/auth.json`.
## Installation via ClawHub
```bash
clawhub install codex-auth-session
```
## Commands (for Codex auth management)
| Command | What it does |
|---------|-------------|
| `login-profile.ps1` | First login / re-login into ChatGPT (for Codex) |
| `run-refresh.ps1` | Refresh Codex's access token now |
| `status.ps1` | Check Codex auth.json status |
| `install-scheduled-task.ps1` | Auto-refresh Codex auth every N hours |
| `create-desktop-toolbox.ps1` | Desktop shortcuts for Codex auth management |
## How It Works
```
You (browser login to ChatGPT)
β
βΌ
Playwright β chatgpt.com/api/auth/session β accessToken
β
βΌ
~/.codex/auth.json
(backup created before update)
β
βΌ
Windows Scheduled Task
(auto-refresh, so Codex never loses auth)
```
## Security
- Token values are **never** logged β `delete safe.token` before write
- `auth.json` backed up with timestamp before every update
- All sensitive paths excluded via `.gitignore`
## Requirements
- **OS:** Windows 10/11
- **Runtime:** Node.js 18+
- **Browser:** Chrome or Microsoft Edge
- **Target:** [Codex CLI](https://github.com/openai/codex) by OpenAI
don't have the plugin yet? install it then click "run inline in claude" again.