Security Best Practices
Essential guidelines for implementing okID verification securely. Protect your users and maintain compliance.
API Key Security
Remember: okID uses a three-tier architecture. Your API key is stored on the frontend server, not in your application code. You never need to handle API keys directly.
Store keys in environment variables
Configure your frontend server with API keys via environment variables, not hardcoded values
Use secure key storage in production
Use platform-specific secret management services:
- • AWS Secrets Manager
- • Azure Key Vault
- • Google Secret Manager
- • HashiCorp Vault
Rotate API keys regularly
Establish a key rotation policy and update keys every 90 days
Never commit keys to version control
Add .env files to .gitignore and use tools like git-secrets to prevent accidental commits
Server Security
Authentication & Authorization
Implement proper authentication before generating verification IDs
Track verification attempts per user to prevent abuse
Log all verification generation requests for audit trails
Rate Limiting
Implement rate limiting on verification endpoints
Consider stricter limits for unauthenticated requests
HTTPS & TLS
Always use HTTPS in production (required for camera access)
Use TLS 1.2 or higher for all API communications
Implement HSTS headers to enforce HTTPS
Data Privacy & GDPR
Ensure compliance with data protection regulations when handling user verification data.
Minimize data collection
Only collect and store verification data necessary for your use case
Implement data retention policies
Set up automatic deletion of verification data after the required period
Provide user consent mechanisms
Use the Terms module to collect explicit consent for data processing
Enable data portability
Provide mechanisms for users to request their verification data
Respect right to erasure
Implement processes to delete user data upon request
Frontend Security
Validate verification results server-side
Never trust client-side verification status. Always validate on your server
Implement Content Security Policy (CSP)
Add CSP headers to prevent XSS attacks and control resource loading
Use Subresource Integrity (SRI)
When loading SDK from CDN, use SRI to ensure file integrity
Sanitize error messages
Don't expose sensitive information in error messages shown to users