Coming Soon - The Watchman Tower WordPress plugin is currently in development. This documentation is prepared in advance for the upcoming release.
Site Token Overview
Site tokens will be unique identifiers that authenticate your WordPress site with Watchman Tower. Each token will be:- Unique: One token per WordPress installation
- Secure: 64-character cryptographically secure string
- Revocable: Can be regenerated at any time
- Scoped: Limited to specific site permissions
Token Format
Tokens will follow this format:wmt_- Watchman Tower prefixprod- Environment indicator (prod, staging, dev)a1b2...- 58-character random string
Generating Tokens
Via Dashboard
1
Navigate to WordPress Integration
Go to Integrations → WordPress in your Watchman Tower dashboard
2
Add New Site
Click Add Site button
3
Fill Site Details
- Site Name: Friendly identifier (e.g., “Production Blog”)
- Site URL: Full URL including protocol
- Environment: Production, Staging, or Development
4
Generate Token
Click Generate Token - token will be created and displayed
5
Copy Token
Copy token immediately - it won’t be shown again for security
Token Security
Storage Options
wp-config.php
Recommended methodStore token in wp-config.php above database settingsBenefits:
- Not in database
- Not accessible via admin UI
- Safe from SQL injection
- Environment-specific
Environment Variable
For advanced setupsLoad token from server environment variableBenefits:
- Separated from code
- Easy rotation
- Deployment-friendly
- Secure
Database (Encrypted)
Automatic fallbackPlugin auto-encrypts tokens in database using WordPress saltsBenefits:
- No manual setup
- Encrypted storage
- Simple for beginners
Token Rotation
For security, tokens should be rotated regularly: Via Dashboard:- Go to Integrations → WordPress → Your Site
- Click Rotate Token
- Copy new token
- Update your wp-config.php or environment variable
- Old token is immediately revoked
- Every 90 days for active sites
- When team members leave
- After security incidents
- For compliance requirements
Token Permissions
What tokens can access:- Site performance metrics
- Plugin list (names and versions only)
- WordPress version information
- PHP version and settings
- Active theme name
- Database size and statistics
- Modify WordPress settings
- Access user data or passwords
- Read post or page content
- Execute code on your site
- Access database directly
- Make changes to your site
Token Lifecycle
Token States
1
Created
Token is generated in the Watchman Tower dashboard and ready to use
2
Active
Token is configured in WordPress and successfully sending metrics
3
Revoked
Token has been revoked via dashboard - plugin will show connection error
4
Regenerated
New token created, old token immediately revoked - requires updating configuration
Multi-Environment Setup
Best Practice: Separate Tokens
Create and use different tokens for each environment:Production
wmt_prod_…Live site with real visitors
Staging
wmt_staging_…Testing environment before deployment
Development
wmt_dev_…Local development environment
- Monitor each environment independently
- Revoke staging/dev tokens without affecting production
- Track metrics per environment
- Better security isolation
Environment Detection
The plugin can automatically detect your environment based on:- Domain name (localhost, staging subdomain, production domain)
- WP_ENV constant in wp-config.php
- Custom environment detection logic
Token Transmission Security
HTTPS Requirement
Tokens are only transmitted over HTTPS connections. The plugin will:- Refuse to activate without HTTPS
- Show admin notice if SSL is not configured
- Prevent token leakage over insecure connections
Authorization Method
Tokens are sent in the Authorization header of API requests to ensure secure transmission and standard authentication practices.Token Masking
For security, tokens are automatically masked in:- WordPress debug logs
- Admin dashboard displays
- Error messages
- System logs
Revoking Tokens
When to Revoke
Revoke tokens immediately when:- Team member with access leaves
- Token may have been compromised
- Site is being decommissioned
- Migrating to new token
- Security audit requires it
How to Revoke
Via Dashboard:- Go to Integrations → WordPress
- Find your site in the list
- Click Revoke Token button
- Confirm the revocation
- Generate new token if you want to reconnect
- Token becomes invalid immediately
- Plugin will show “Connection Failed” status
- No more metrics will be sent
- Historical data remains accessible
- You can generate a new token to reconnect
Troubleshooting
Invalid token error
Invalid token error
Common Causes:
- Token was revoked in the dashboard
- Token was regenerated but not updated in WordPress
- Wrong token copied (typo or wrong environment)
- Token string has extra spaces
- Verify token in Watchman Tower dashboard
- Check token definition in wp-config.php
- Generate fresh token and update configuration
- Ensure no trailing spaces when copying
Token not found
Token not found
Common Causes:
- Token constant not defined in wp-config.php
- Environment variable not set on server
- Configuration file not loaded properly
- Check if WATCHMAN_TOWER_TOKEN is defined in wp-config.php
- Verify wp-config.php is being loaded
- For environment variables, check server configuration
- Add token definition above the “That’s all, stop editing!” comment
Connection error with valid token
Connection error with valid token
Common Causes:
- Firewall blocking outbound HTTPS connections
- Server can’t reach api.watchmantower.com
- DNS resolution issues
- cURL not available in PHP
- Test connectivity to api.watchmantower.com from your server
- Check firewall rules and whitelist our API domain
- Verify DNS is resolving correctly
- Confirm PHP cURL extension is installed and enabled
- Contact your hosting provider if issue persists
Security Best Practices
Store in wp-config.php, not database
Store in wp-config.php, not database
Always store tokens in wp-config.php above database settings, not in WordPress admin settings or database. This prevents tokens from being exposed via admin UI or SQL injection.
Use separate tokens per environment
Use separate tokens per environment
Create different tokens for production, staging, and development. This allows independent monitoring and secure token rotation without affecting other environments.
Rotate tokens every 90 days
Rotate tokens every 90 days
Regular token rotation reduces security risks. Also rotate immediately when team members leave or if you suspect compromise.
Never commit tokens to version control
Never commit tokens to version control
Add wp-config.php and .env files to .gitignore. Use environment variables or deployment scripts to inject tokens during deployment.
Revoke unused tokens immediately
Revoke unused tokens immediately
When decommissioning a site or stopping monitoring, revoke the token right away to prevent potential security issues.
Monitor token usage regularly
Monitor token usage regularly
Check the “Last used” timestamp in your dashboard. If a token hasn’t been used recently but should be active, investigate why.
Use HTTPS everywhere
Use HTTPS everywhere
Ensure your WordPress site runs on HTTPS. The plugin requires SSL/TLS to protect token transmission.
Limit token access
Limit token access
Only share tokens with team members who need access. Store them securely in password managers, not in plain text files or emails.
