Security Best Practices
API Key Security
Never Expose in Client Code
// ❌ Bad - hardcoded API key
const client = new DotPassportClient({
apiKey: 'dp_live_abc123xyz'
});
// ✅ Good - environment variable
const client = new DotPassportClient({
apiKey: process.env.DOTPASSPORT_API_KEY
});Environment Variables
React (Vite)
# .env
VITE_DOTPASSPORT_API_KEY=your_api_keyNext.js
Node.js Backend
Rate Limiting Protection
Input Validation
CORS Configuration
Content Security Policy
Secure Widget Embedding
Iframe Sandboxing
Subresource Integrity
Data Privacy
Minimal Data Collection
Cache Sensitive Data Carefully
Error Message Handling
Backend Proxy Pattern
Security Checklist
Reporting Security Issues
Related
Last updated
