360 Secure SkillHub
360 安全技能中心

Wordpress OAuth

该 Skill 通过 Python 3 脚本完成 WordPress.com OAuth 授权、回调换取令牌、令牌有效性检查,并可向 WordPress.com 或 Jetpack 连接站点发布草稿或已发布文章;状态与凭据保存在技能目录内。

ibrahimelnemr
ibrahimelnemr
热度 51.74
最近更新 2026-05-11 17:32:13
分类:营销依赖:代码执行 / 读写文件 / 第三方 API应用场景:博客写作 / 社交媒体 / API 集成 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add wordpress-oauth
Metadata
name
wordpress-oauth
description
Start and complete WordPress.com OAuth and publish posts through the WordPress.com REST API. Use when you need to generate an authorization URL, exchange callback code for an access token, validate token health, or publish draft/published posts to a WordPress.com or Jetpack-connected site.

WordPress OAuth Skill

Use this skill to run a human-in-the-loop OAuth flow and publish posts with a stored bearer token.

Files in this skill

  • Script: {baseDir}/wp_oauth_skill.py
  • OAuth state store: {baseDir}/oauth_state.json
  • Credential store: {baseDir}/credentials.json

This skill stores state and credentials in files inside this skill directory.

Commands

Run the script with Python 3:

python3 {baseDir}/wp_oauth_skill.py --help

1) Begin OAuth

python3 {baseDir}/wp_oauth_skill.py begin-oauth \
  --client-id "$WPCOM_CLIENT_ID" \
  --redirect-uri "$WPCOM_REDIRECT_URI" \
  --scope "posts media" \
  --blog "$WPCOM_SITE"

Returns auth_url and state. Open the URL, approve access, then copy the callback URL.

2) Exchange Token

python3 {baseDir}/wp_oauth_skill.py exchange-token \
  --client-id "$WPCOM_CLIENT_ID" \
  --client-secret "$WPCOM_CLIENT_SECRET" \
  --redirect-uri "$WPCOM_REDIRECT_URI" \
  --callback-url "https://example/callback?code=...&state=..."

Validates CSRF state, exchanges code for token, and writes credentials to {baseDir}/credentials.json.

3) Token Info

python3 {baseDir}/wp_oauth_skill.py token-info --client-id "$WPCOM_CLIENT_ID"

Checks token validity with WordPress token-info endpoint.

4) Publish Post

python3 {baseDir}/wp_oauth_skill.py publish-post \
  --site "$WPCOM_SITE" \
  --title "My post" \
  --content "<p>Hello from OpenClaw</p>" \
  --status draft

Publishes a post via POST /rest/v1.1/sites/$site/posts/new using the stored token.

Recommended flow

  1. Run begin-oauth.
  2. Open auth_url in browser and authorize.
  3. Paste callback URL into exchange-token.
  4. Optionally run token-info.
  5. Run publish-post.

Security notes

  • Never share credentials.json or client secrets.
  • Keep first test posts as draft.
  • Re-run begin-oauth if callback state fails or auth code expires.