🔐 CO.ZA API - Environment-Based Authentication
❌ Configuration Error
Environment file not found at: /var/www/vhosts/oner.co.za/coza-api.oner.co.za/src/Core/../.env
Please ensure the .env file exists and is properly formatted.
🚀 Quick Start
1. Test Authentication
Verify your API keys are working:
2. Protected Endpoints
Access protected API endpoints:
📋 Authentication Methods
1. Authorization Header (Recommended)
curl -H "Authorization: Bearer sk_test_def456uvw012" \
https://your-api.com/api/endpoint
2. X-API-Key Header
curl -H "X-API-Key: sk_test_def456uvw012" \
https://your-api.com/api/endpoint
3. Query Parameter
curl "https://your-api.com/api/endpoint?api_key=sk_test_def456uvw012"
⚙️ Configuration
API keys are now managed through the .env file instead of the database:
# .env file
VALID_API_KEYS=sk_live_abc123xyz789,sk_test_def456uvw012,sk_prod_ghi789rst345
API_ENVIRONMENT=development
📚 Documentation
🔄 Migration Benefits
- No Database Dependency: API key validation works without database connection
- Environment-Specific: Different keys for different environments
- Simple Management: Update keys by editing .env file
- Version Control Safe: .env files stay out of git repositories
- Fast Performance: No database queries for authentication
🎉 Migration Complete!
Your API now uses .env-based authentication instead of database authentication.
All existing functionality is preserved with improved performance and security.