Credential management
Never hardcode secrets
Use environment variables
HTTPS everywhere
- Development: Use localhost or mkcert
- Production: TLS 1.2 or higher required
- Certificates: Use Let’s Encrypt or commercial CA
- HSTS: Enable HTTP Strict Transport Security
CSRF protection
SameSite cookies
CSRF tokens
XSS prevention
HttpOnly cookies
Content Security Policy
Input validation
Rate limiting
Secure redirects
Validate redirect URLs
Error handling
Generic error messages
Logging and monitoring
Log authentication events
Monitor for threats
- Failed login attempts
- Token refresh failures
- Unusual access patterns
- Geographic anomalies
Next steps
Token management
Secure token handling
Session policies
Configure session security