@abdalsalaam/chatgpt-wp-connect
v0.1.0
Published
Local OAuth helper for the WordPress 'AI Provider for ChatGPT' plugin. Runs the Codex-style PKCE flow on your laptop and posts the resulting tokens back to your WordPress site.
Maintainers
Readme
@abdalsalaam/chatgpt-wp-connect
Local OAuth helper for the WordPress AI Provider for ChatGPT plugin. Runs the Codex CLI–style PKCE flow on your laptop and posts the resulting tokens to your WordPress site so you don't have to copy ~/.codex/auth.json by hand.
Usage
In your WordPress admin: Settings → ChatGPT → Connect with ChatGPT. The page shows a one-line command — copy and run it on your laptop:
npx @abdalsalaam/chatgpt-wp-connect https://your-site.example a1b2c3...64hexYour default browser opens to OpenAI's sign-in page. Approve, and the WordPress tab connects automatically.
Requirements
- Node.js 18 or newer.
- Port
1455(or1457as fallback) free on127.0.0.1. - A reachable WordPress site running the
ai-provider-for-chatgptplugin ≥ 0.3.0.
What it does
- Generates a PKCE code_verifier / code_challenge (S256, per RFC 7636).
- Binds a one-shot HTTP listener on
127.0.0.1:1455(fallback1457) at/auth/callback. - Opens
https://auth.openai.com/oauth/authorize?...in your default browser, using the public Codex CLI client id (app_EMoamEEZ73f0CkXaXp7hrann). - Receives the
codeon the local listener, then POSTs tohttps://auth.openai.com/oauth/tokenwithgrant_type=authorization_codeand the PKCE verifier. - Extracts the
chatgpt_account_idclaim from the returnedid_token. - POSTs
{ token, bundle }to<your-site>/wp-json/ai-provider-for-chatgpt/v1/connection/pair. The plugin validates the one-time pairing token, then stores the encrypted bundle.
The pairing token issued by the WordPress UI is single-use and expires after 10 minutes.
Security notes
- Tokens never leave your machine and your WordPress server.
- The OAuth flow is identical to
codex login; this CLI does not see your password. - The pairing endpoint on WordPress is public but accepts only a 64-character hex token issued seconds earlier by a logged-in admin.
License
GPL-2.0-or-later
