Prerequisites
- Node.js environment (for backend) or a modern web browser (for frontend)
- npm or yarn package manager
- SunLicense API credentials
Integration steps
1. Backend implementation (Node.js)
2. Frontend implementation (browser)
Never expose your license key in frontend code. Prefer server-side validation.
3. Framework integrations
Express.js middleware
React component
Best practices
- Security
- Never expose the license key in frontend code
- Implement server-side validation
- Use secure communication (HTTPS)
- Error handling
- Implement proper error handling
- Show user-friendly error messages
- Log validation failures
- Performance
- Cache validation results
- Implement retry mechanisms
- Handle offline scenarios
Common issues and solutions
- CORS issues
- Configure proper CORS headers
- Use a proxy for API requests
- Handle preflight requests
- Network problems
- Implement timeout handling
- Add retry logic
- Cache validation results