WordPress · Verificación de dominio
El plugin neuroon-search no usa meta-tags ni registros DNS para verificar el dominio. Confía en la API Key + el header Origin: cuando pulsas Verify Domain en el admin, el plugin envía POST /api/plugin/shops/verify con el dominio actual y el backend lo compara (tras normalizeUrl) con el shop.url ya registrado en Neuroon.
Cita: handlers
admin_post_neuroon_verify/admin_post_neuroon_unverifyenwordpress-plugin/neuroon-search/neuroon-verification.phpy endpoints listados enwordpress-plugin/CLAUDE.md.
Cómo funciona el flujo
-
Generas la Shop API Key en el dashboard de Neuroon.
-
La pegas en Settings → Neuroon Search → Settings tab.
-
Pulsas Verify Domain.
-
El plugin envía:
POST/api/plugin/shops/verifyPOST /api/plugin/shops/verify HTTP/1.1Host: dev-api.neuroon.aiX-Shop-API-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxOrigin: https://your-domain.exampleContent-Type: application/json{"domain": "https://your-domain.example"} -
Si el dominio normalizado coincide con el
shop.urlregistrado, el backend devuelve:{"shopId": "shop_xxxxxxxx","verificationCode": "vc_yyyyyyyy","domain": "https://your-domain.example","name": "Your Shop"} -
El plugin guarda
neuroon_shop_id,neuroon_verification_codey marcaneuroon_verified = 1enwp_options. Las pestañas Products, Widget y Diagnostics aparecen.
Recuperar datos de verificación
Para inspeccionar el estado actual sin re-verificar:
/api/plugin/shops/{shopId}/verification-datacurl -s "https://dev-api.neuroon.ai/api/plugin/shops/$NEUROON_SHOP_ID/verification-data" \
-H "X-Shop-API-Key: $NEUROON_API_KEY" \
-H "Origin: https://your-domain.example"
Devuelve { verificationCode, instructions, verified } (VerificationDataDTO en ShopResponseDTO.java:25). Útil para diagnósticos sin tocar el flujo de escritura. Nota: el POST /verify devuelve un payload distinto (PluginVerificationDataDTO { shopId, verificationCode, domain, name }).
Desverificar (unverify)
Si vendes la tienda, mueves de dominio o quieres rotar credenciales:
/api/plugin/shops/{shopId}/verifycurl -X DELETE "https://dev-api.neuroon.ai/api/plugin/shops/$NEUROON_SHOP_ID/verify" \
-H "X-Shop-API-Key: $NEUROON_API_KEY" \
-H "Origin: https://your-domain.example"
Desde el admin, Settings tab → Unverify Domain dispara la misma llamada y limpia las opciones locales.
Rotar la API Key
Las API Keys son revocables. Si una key se ha filtrado:
- Genera una key nueva en el dashboard de Neuroon.
- Actualiza Settings → Neuroon Search → API Key y guarda.
- Revoca la antigua desde el dashboard.
El plugin no almacena la key en plano fuera de wp_options (neuroon_api_key). En entornos compartidos, restringe el acceso a la base de datos y considera mover la key a una constante en wp-config.php con un filtro propio.
Errores frecuentes
| Código | Causa | Solución |
|---|---|---|
401 Unauthorized | API Key inválida o revocada | Regenera y vuelve a pegar la key. |
403 Forbidden | Origin no coincide con el dominio registrado | Comprueba get_site_url(). Aliases (www. vs apex) deben coincidir con la URL almacenada en shop.url. |
404 Not Found | El shopId no existe o no pertenece a tu key | Pulsa Verify Domain desde cero; el plugin reescribe neuroon_shop_id. |
429 Too Many Requests | Rate limit verification (20/min) o verify-action (5/5min) superado | Espera el Retry-After. El plugin lo absorbe vía Neuroon_Rate_Limit_Handler. |
Buenas prácticas
- Verifica desde el dominio canónico que vas a usar en producción. Si tu tienda fuerza
https://www.example.com, no verifiqueshttps://example.com. - No expongas la API Key al frontend. Solo se usa server-to-server desde PHP.
- Re-verifica tras un cambio de URL (
siteurlohomeen WP). El backend comparanormalizeUrl(domain)exacto.
Próximos pasos
- Sync de productos — la pestaña Products solo se habilita tras verificar.
- Authentication · Shop API Key — alcance, rotación y rate limits.
- Reference · Errores — catálogo de códigos.