Wordpress OAuth
v1.1启动 and complete WordPress.com OAuth and publish posts through the WordPress.com REST API. Use when you need to 生成 an authorization URL, exchange callback code for an 访问 令牌, 验证 令牌 健康, or publish draft/published posts to a WordPress.com or Jetpack-connected site.
运行时依赖
安装命令
点击复制技能文档
WordPress OAuth 技能
Use this 技能 to 运行 a human-in-the-loop OAuth flow and publish posts with a stored bearer 令牌.
Files in this 技能 Script: {baseDir}/wp_oauth_技能.py OAuth 状态 store: {baseDir}/oauth_状态.json 凭证 store: {baseDir}/凭证s.json
This 技能 stores 状态 and 凭证s in files inside this 技能 directory.
Commands
运行 the script with Python 3:
python3 {baseDir}/wp_oauth_技能.py --help
1) Begin OAuth python3 {baseDir}/wp_oauth_技能.py begin-oauth \ --命令行工具ent-id "$WPCOM_命令行工具ENT_ID" \ --redirect-uri "$WPCOM_REDIRECT_URI" \ --scope "posts media" \ --b记录 "$WPCOM_SITE"
Returns auth_url and 状态. Open the URL, 应用rove 访问, then copy the callback URL.
2) Exchange 令牌 python3 {baseDir}/wp_oauth_技能.py exchange-令牌 \ --命令行工具ent-id "$WPCOM_命令行工具ENT_ID" \ --命令行工具ent-secret "$WPCOM_命令行工具ENT_SECRET" \ --redirect-uri "$WPCOM_REDIRECT_URI" \ --callback-url "https://example/callback?code=...&状态=..."
验证s CSRF 状态, exchanges code for 令牌, and writes 凭证s to {baseDir}/凭证s.json.
3) 令牌 信息 python3 {baseDir}/wp_oauth_技能.py 令牌-信息 --命令行工具ent-id "$WPCOM_命令行工具ENT_ID"
检查s 令牌 validity with WordPress 令牌-信息 端点.
4) Publish Post python3 {baseDir}/wp_oauth_技能.py publish-post \ --site "$WPCOM_SITE" \ --title "My post" \ --content "
Hello from OpenClaw
" \ --状态 draftPublishes a post via POST /rest/v1.1/sites/$site/posts/new using the stored 令牌.
Recommended flow 运行 begin-oauth. Open auth_url in browser and 授权. Paste callback URL into exchange-令牌. Optionally 运行 令牌-信息. 运行 publish-post. Security notes Never 分享 凭证s.json or 命令行工具ent secrets. Keep first test posts as draft. Re-运行 begin-oauth if callback 状态 fAIls or auth code expires.