Authentication Template

This template helps you implement secure authentication systems using modern best practices. It covers various authentication methods, security considerations, and implementation patterns for different types of applications.

Sample Prompt

Implement JWT-based authentication system with:
- User registration and login endpoints
- Password validation and hashing
- JWT token generation with refresh tokens
- Rate limiting for auth endpoints
- OAuth integration with Google
- Multi-factor authentication support

Include security best practices and proper error handling.

What This Template Covers

  • JWT token-based authentication with refresh token rotation
  • OAuth 2.0 integration with popular providers (Google, GitHub, etc.)
  • Multi-factor authentication (MFA) implementation
  • Password security with proper hashing and validation
  • Session management and security headers
  • Rate limiting and brute force protection

Best Practices

  1. Use strong password policies with minimum complexity requirements
  2. Implement rate limiting to prevent brute force attacks
  3. Store passwords securely using bcrypt with appropriate salt rounds
  4. Use JWT responsibly with short expiration times and refresh token rotation
  5. Implement proper session management with secure cookies
  6. Add security headers (HSTS, CSP, etc.)
  7. Log authentication events for security monitoring
  8. Regularly audit and update dependencies for security vulnerabilities

When to Use This Template

  • Building user authentication for web applications
  • Implementing secure API access controls
  • Adding OAuth integration with third-party providers
  • Upgrading existing authentication systems
  • Meeting compliance requirements for user data security

The Script

peep authentication