원클릭으로
wp-api
Use when working on WCPOS REST API endpoints, debugging auth issues, or understanding the plugin's API structure.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when working on WCPOS REST API endpoints, debugging auth issues, or understanding the plugin's API structure.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | wp-api |
| description | Use when working on WCPOS REST API endpoints, debugging auth issues, or understanding the plugin's API structure. |
The WCPOS REST API routes (/wcpos/v1/) are ONLY registered when the X-WCPOS: 1 header is present.
# WITHOUT header - wcpos/v1 NOT in namespaces
curl http://localhost:8888/wp-json/
# WITH header - wcpos/v1 IS in namespaces
curl -H "X-WCPOS: 1" http://localhost:8888/wp-json/
WCPOS uses JWT tokens for mobile/POS client authentication. The admin/settings frontend uses standard WordPress cookie authentication via @wordpress/api-fetch — no bearer token is needed for those requests.
npx wp-env run cli -- wp eval '
$auth = WCPOS\WooCommercePOS\Services\Auth::instance();
$user = get_user_by("ID", 1);
echo json_encode($auth->generate_token_pair($user));
'
Authorization: Bearer <token>?authorization=Bearer%20<token>⚠️ Query-parameter tokens may be exposed in server logs, browser history, and proxies. Use only when header forwarding is unavailable, and only in controlled environments.
Apache CGI/FastCGI strips the Authorization header by default. Add to .htaccess:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
IMPORTANT: The .htaccess SetEnvIf rule sets HTTP_AUTHORIZATION to empty string "" when no Authorization header is sent. The code must use !empty() instead of isset() to check for auth headers.
# Pretty permalinks (needs .htaccess rewrite rules)
/wp-json/wcpos/v1/products
# Query string (always works)
/?rest_route=/wcpos/v1/products
curl -s \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "X-WCPOS: 1" \
"http://localhost:8888/?rest_route=/wcpos/v1/products"
| URL Format | Header Auth | Param Auth |
|---|---|---|
Query String (?rest_route=) | Yes | Yes |
Pretty Permalink (/wp-json/) | Yes | Yes |
X-WCPOS: 1 header -> 404 or empty namespace/wp-json/ without working Apache rewrite -> 404.htaccess SetEnvIf -> Authorization header stripped -> 401isset() instead of !empty() for $_SERVER['HTTP_AUTHORIZATION'] -> param auth failsplugins_loaded -> init (determine_current_user) -> rest_api_init
Init.php: determine_current_user filter at priority 20 (handles JWT auth, runs during init BEFORE rest_api_init)API.php: Routes registered on rest_api_init (user already authenticated by this point)