3.2 KiB
3.2 KiB
Zoho OAuth Setup Instructions
Prerequisites
- Zoho CRM account
- Admin access to create OAuth applications
- Access to staging server terminal
Step 1: Create Zoho OAuth Application
-
Go to Zoho API Console
-
Click "Add Client" or "Create New Client"
-
Choose "Web Based" application type
-
Fill in the details:
- Client Name: HVAC Community Events
- Homepage URL: https://upskillhvac.com
- Authorized Redirect URIs: http://localhost:8080/callback
- Description: WordPress integration for HVAC event management
-
Click "Create" and save the credentials:
- Client ID
- Client Secret
Step 2: Configure Environment Variables
Add to your .env file:
ZOHO_CLIENT_ID=your_client_id_here
ZOHO_CLIENT_SECRET=your_client_secret_here
Step 3: Run OAuth Setup
From your terminal:
cd /Users/ben/dev/upskill-event-manager/wordpress-dev
./bin/zoho-setup-complete.sh
This script will:
- Start a local callback server
- Generate the authorization URL
- Open your browser for Zoho login
- Handle the OAuth callback
- Save the tokens
Step 4: Complete Authorization
- When the browser opens, log in to Zoho
- Review the permissions requested:
- CRM Settings access
- CRM Modules access
- CRM Users access
- CRM Organization access
- Click "Accept" or "Allow"
- You'll be redirected to localhost:8080/callback
- Copy the authorization code from the page
- Return to terminal and paste the code
Step 5: Verify Setup
The script will:
- Exchange the code for tokens
- Test the connection
- Save configuration to
zoho-config.php - Display success message
Manual Setup (Alternative)
If the automated script doesn't work:
- Start callback server:
cd wordpress/wp-content/plugins/hvac-community-events/includes/zoho
php -S localhost:8080 callback-server.php
- Generate authorization URL:
php test-integration.php
- Open the URL in your browser
- Complete authorization
- Copy the code and paste when prompted
Testing the Integration
After setup, test on staging:
- Go to WordPress Admin
- Navigate to HVAC Community Events → Zoho CRM Sync
- Click "Test Connection"
- In staging mode, you'll see simulation results only
Troubleshooting
Common Issues
-
"Client authentication failed"
- Double-check Client ID and Secret
- Ensure no extra spaces in .env file
-
"Invalid redirect URI"
- Make sure redirect URI in Zoho matches exactly: http://localhost:8080/callback
- No trailing slash
-
Connection refused on localhost:8080
- Ensure no other service is using port 8080
- Try a different port if needed
-
Token expired
- Tokens auto-refresh, but if issues persist, re-run setup
Debug Mode
Enable debug logging:
define('ZOHO_DEBUG_MODE', true);
define('ZOHO_LOG_FILE', '/path/to/debug.log');
Security Notes
- Never commit .env or zoho-config.php to version control
- Tokens are stored encrypted in WordPress options
- Refresh tokens are used for long-term access
- Staging mode prevents accidental production syncs
Support
For issues:
- Check debug logs
- Verify OAuth application settings
- Review Zoho API documentation
- Contact development team