two-factor-authentication-best-practices

Warn

Audited by Runlayer on Mar 3, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
78%
Files
1
Flagged
1
Chunks
2
Flagged Files (1)
two-factor-authentication-best-practices/SKILL.mdMEDIUM
77.5%

Malicious tool definition detected

### Client-Side Setup Add the client plugin and configure the redirect behavior for 2FA verification: ```ts import { createAuthClient } from "better-auth/client"; import { twoFactorClient } from "better-auth/client/plugins"; export const authClient = createAuthClient({ plugins: [ twoFactorClient({ onTwoFactorRedirect() { window.location.href = "/2fa"; // Redirect to your 2FA verification page }, }), ], }); ``` ## Enabling 2FA for Users When a user enables 2FA, require their password for verifica

Session cookie is created upon successful verification Configure the two-factor cookie expiration: ```ts twoFactor({ twoFactorCookieMaxAge: 600, // 10 minutes in seconds (default) }); ``` ### Rate Limiting Better Auth applies built-in rate limiting to all 2FA endpoints (3 requests per 10 seconds).

Audit Metadata
Max File Score
78%
Classification
KNOWN_SERVER_KNOWN_TOOL_LIST
Files Scanned
1
Files Flagged
1
Chunks Analyzed
2
Analyzed
Mar 3, 2026, 04:22 AM
Security Audit — runlayer — two-factor-authentication-best-practices