better-auth-security-best-practices

Configure Better Auth security with rate limiting, CSRF protection, and audit logging.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/gigun-dev/hono-caldav --skill better-auth-security-best-practices-gigun-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-security-best-practices
Source: https://github.com/gigun-dev/hono-caldav/tree/main/.claude/skills/better-auth/security
Command: npx skills add https://github.com/gigun-dev/hono-caldav --skill better-auth-security-best-practices-gigun-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you harden your authentication system by implementing robust security measures, preventing common attacks, and ensuring the integrity of user data.

Core Features & Use Cases

  • Secret Management: Securely configure and manage authentication secrets.
  • Rate Limiting: Protect against brute-force attacks and denial-of-service.
  • CSRF Protection: Prevent cross-site request forgery attacks.
  • Session & Cookie Security: Harden session management and cookie attributes.
  • OAuth Security: Securely handle OAuth tokens and state parameters.
  • Audit Logging: Implement hooks for tracking security-relevant events.
  • Use Case: You need to deploy your application to production and want to ensure that your authentication system is protected against common vulnerabilities like brute-force attacks and session hijacking.

Quick Start

Configure rate limiting for the sign-in endpoint to allow a maximum of 5 attempts per minute.

Frequently Asked Questions about better-auth-security-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure authentication in Better Auth for production?

Secure Better Auth authentication for production by configuring secret management, rate limiting, CSRF protection, trusted origins, and session cookie security to prevent unauthorized access. This implements layered security measures against common web vulnerabilities.

What's the best way to prevent brute-force attacks on authentication endpoints?

Prevent brute-force attacks on authentication endpoints by configuring rate limiting within Better Auth, such as allowing a maximum of 5 sign-in attempts per minute to protect against denial-of-service and unauthorized access.

Does Better Auth support CSRF protection and secure OAuth token handling?

Better Auth supports CSRF protection and secure OAuth token handling by configuring trusted origins, encrypting OAuth tokens, and hardening state parameters to maintain data integrity and prevent cross-site request forgery.

How do I track security-relevant events during user authentication?

Track security-relevant events during user authentication by implementing audit logging hooks in Better Auth, capturing session activities and IP tracking data to maintain production environment integrity.

Can I harden session management and cookie attributes with Better Auth?

You can harden session management and cookie attributes with Better Auth by configuring specific session security settings, protecting against session hijacking and ensuring secure user data handling in production environments.

When do I need to configure trusted origins for authentication security?

Configure trusted origins for authentication security when deploying to production environments to prevent unauthorized access, ensure request validation, and protect against common web vulnerabilities like cross-site request forgery.