Remote OpenClaw
Menu
SkillsMCPPluginsFree guideDigestSubmit MCPSkillPluginMCPMCP, plugin, or skillAdvertise
Remote OpenClaw
SkillsMCPPluginsFree guideDigestSubmit MCPSkillPluginMCPMCP, plugin, or skillAdvertise

Featured

Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Skills/better-auth/skills/two-factor-authentication-best-practices
two-factor-authentication-best-practices logo

two-factor-authentication-best-practices

better-auth/skills
19K installs198 stars
Run it on Hostinger →up to 70% off + an extra 10% with code ZACAARON10Free API →

Installation

npx skills add https://github.com/better-auth/skills --skill two-factor-authentication-best-practices

Summary

Configure TOTP authenticator apps, send OTP codes via email/SMS, manage backup codes, handle trusted devices, and implement 2FA sign-in flows using Better Auth's twoFactor plugin. Use when users need MFA, multi-factor authentication, authenticator setup, or login security with Better Auth.

SKILL.md

Setup

  1. Add twoFactor() plugin to server config with issuer
  2. Add twoFactorClient() plugin to client config
  3. Run npx @better-auth/cli migrate
  4. Verify: check that twoFactorSecret column exists on user table
import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";

export const auth = betterAuth({
  appName: "My App",
  plugins: [
    twoFactor({
      issuer: "My App",
    }),
  ],
});

Client-Side Setup

import { createAuthClient } from "better-auth/client";
import { twoFactorClient } from "better-auth/client/plugins";

export const authClient = createAuthClient({
  plugins: [
    twoFactorClient({
      onTwoFactorRedirect() {
        window.location.href = "/2fa";
      },
    }),
  ],
});

Enabling 2FA for Users

Requires password verification. Returns TOTP URI (for QR code) and backup codes.

const enable2FA = async (password: string) => {
  const { data, error } = await authClient.twoFactor.enable({
    password,
  });

  if (data) {
    // data.totpURI — generate a QR code from this
    // data.backupCodes — display to user
  }
};

twoFactorEnabled is not set to true until first TOTP verification succeeds. Override with skipVerificationOnEnable: true (not recommended).

TOTP (Authenticator App)

Displaying the QR Code

import QRCode from "react-qr-code";

const TotpSetup = ({ totpURI }: { totpURI: string }) => {
  return <QRCode value={totpURI} />;
};

Verifying TOTP Codes

Accepts codes from one period before/after current time:

const verifyTotp = async (code: string) => {
  const { data, error } = await authClient.twoFactor.verifyTotp({
    code,
    trustDevice: true,
  });
};

TOTP Configuration Options

twoFactor({
  totpOptions: {
    digits: 6, // 6 or 8 digits (default: 6)
    period: 30, // Code validity period in seconds (default: 30)
  },
});

OTP (Email/SMS)

Configuring OTP Delivery

import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";
import { sendEmail } from "./email";

export const auth = betterAuth({
  plugins: [
    twoFactor({
      otpOptions: {
        sendOTP: async ({ user, otp }, ctx) => {
          await sendEmail({
            to: user.email,
            subject: "Your verification code",
            text: `Your code is: ${otp}`,
          });
        },
        period: 5, // Code validity in minutes (default: 3)
        digits: 6, // Number of digits (default: 6)
        allowedAttempts: 5, // Max verification attempts (default: 5)
      },
    }),
  ],
});

Sending and Verifying OTP

Send: authClient.twoFactor.sendOtp(). Verify: authClient.twoFactor.verifyOtp({ code, trustDevice: true }).

OTP Storage Security

Configure how OTP codes are stored in the database:

twoFactor({
  otpOptions: {
    storeOTP: "encrypted", // Options: "plain", "encrypted", "hashed"
  },
});

For custom encryption:

twoFactor({
  otpOptions: {
    storeOTP: {
      encrypt: async (token) => myEncrypt(token),
      decrypt: async (token) => myDecrypt(token),
    },
  },
});

Backup Codes

Generated automatically when 2FA is enabled. Each code is single-use.

Displaying Backup Codes

const BackupCodes = ({ codes }: { codes: string[] }) => {
  return (
    <div>
      <p>Save these codes in a secure location:</p>
      <ul>
        {codes.map((code, i) => (
          <li key={i}>{code}</li>
        ))}
      </ul>
    </div>
  );
};

Regenerating Backup Codes

Invalidates all previous codes:

const regenerateBackupCodes = async (password: string) => {
  const { data, error } = await authClient.twoFactor.generateBackupCodes({
    password,
  });
  // data.backupCodes contains the new codes
};

Using Backup Codes for Recovery

const verifyBackupCode = async (code: string) => {
  const { data, error } = await authClient.twoFactor.verifyBackupCode({
    code,
    trustDevice: true,
  });
};

Backup Code Configuration

twoFactor({
  backupCodeOptions: {
    amount: 10, // Number of codes to generate (default: 10)
    length: 10, // Length of each code (default: 10)
    storeBackupCodes: "encrypted", // Options: "plain", "encrypted"
  },
});

Handling 2FA During Sign-In

Response includes twoFactorRedirect: true when 2FA is required:

Sign-In Flow

  1. Call signIn.email({ email, password })
  2. Check context.data.twoFactorRedirect in onSuccess
  3. If true, redirect to /2fa verification page
  4. Verify via TOTP, OTP, or backup code
  5. Session cookie is created on successful verification
const signIn = async (email: string, password: string) => {
  const { data, error } = await authClient.signIn.email(
    { email, password },
    {
      onSuccess(context) {
        if (context.data.twoFactorRedirect) {
          window.location.href = "/2fa";
        }
      },
    }
  );
};

Server-side: check "twoFactorRedirect" in response when using auth.api.signInEmail.

Trusted Devices

Pass trustDevice: true when verifying. Default trust duration: 30 days (trustDeviceMaxAge). Refreshes on each sign-in.

Security Considerations

Session Management

Flow: credentials → session removed → temporary 2FA cookie (10 min default) → verify → session created.

twoFactor({
  twoFactorCookieMaxAge: 600, // 10 minutes in seconds (default)
});

Rate Limiting

Built-in: 3 requests per 10 seconds for all 2FA endpoints. OTP has additional attempt limiting:

twoFactor({
  otpOptions: {
    allowedAttempts: 5, // Max attempts per OTP code (default: 5)
  },
});

Encryption at Rest

TOTP secrets: encrypted with auth secret. Backup codes: encrypted by default. OTP: configurable ("plain", "encrypted", "hashed"). Uses constant-time comparison for verification.

2FA can only be enabled for credential (email/password) accounts.

Disabling 2FA

Requires password confirmation. Revokes trusted device records:

const disable2FA = async (password: string) => {
  const { data, error } = await authClient.twoFactor.disable({
    password,
  });
};

Complete Configuration Example

import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";
import { sendEmail } from "./email";

export const auth = betterAuth({
  appName: "My App",
  plugins: [
    twoFactor({
      // TOTP settings
      issuer: "My App",
      totpOptions: {
        digits: 6,
        period: 30,
      },
      // OTP settings
      otpOptions: {
        sendOTP: async ({ user, otp }) => {
          await sendEmail({
            to: user.email,
            subject: "Your verification code",
            text: `Your code is: ${otp}`,
          });
        },
        period: 5,
        allowedAttempts: 5,
        storeOTP: "encrypted",
      },
      // Backup code settings
      backupCodeOptions: {
        amount: 10,
        length: 10,
        storeBackupCodes: "encrypted",
      },
      // Session settings
      twoFactorCookieMaxAge: 600, // 10 minutes
      trustDeviceMaxAge: 30 * 24 * 60 * 60, // 30 days
    }),
  ],
});

Score

0–100
74/ 100

Grade

B

Popularity26/30

18,547 installs — strong, widely used.

Completeness27/30

Documented: full SKILL.md body, description, one-line install. Missing: category/license metadata.

Trust15/25

Community skill with a public GitHub source repository you can review.

Freshness6/15

No update timestamp is tracked for this skill in our catalog.

Scored automatically from popularity, completeness, trust, and freshness — computed only from data in our catalog, never fabricated.

Proud of your score? Add this badge to your README.

Paste a snippet into your GitHub README. The badge updates automatically and links back to this page.

Two Factor Authentication Best Practices skill score badge previewScore badge

Markdown

[![Two Factor Authentication Best Practices skill](https://www.remoteopenclaw.com/skills/better-auth/skills/two-factor-authentication-best-practices/badges/score.svg)](https://www.remoteopenclaw.com/skills/better-auth/skills/two-factor-authentication-best-practices)

HTML

<a href="https://www.remoteopenclaw.com/skills/better-auth/skills/two-factor-authentication-best-practices"><img src="https://www.remoteopenclaw.com/skills/better-auth/skills/two-factor-authentication-best-practices/badges/score.svg" alt="Two Factor Authentication Best Practices skill"/></a>

Two Factor Authentication Best Practices FAQ

How do I install the Two Factor Authentication Best Practices skill?

Run “npx skills add https://github.com/better-auth/skills --skill two-factor-authentication-best-practices” in your terminal. The skill is added to your agent's skills directory and picked up automatically on the next run — no restart or extra configuration needed.

What does the Two Factor Authentication Best Practices skill do?

Configure TOTP authenticator apps, send OTP codes via email/SMS, manage backup codes, handle trusted devices, and implement 2FA sign-in flows using Better Auth's twoFactor plugin. Use when users need MFA, multi-factor authentication, authenticator setup, or login security with Better Auth. The full SKILL.md on this page shows the exact instructions the skill gives your agent.

Is the Two Factor Authentication Best Practices skill free?

Yes. Two Factor Authentication Best Practices is a free, open-source skill published from better-auth/skills. As with any third-party skill, review the source repository before installing it into an agent with sensitive access.

Does Two Factor Authentication Best Practices work with Claude Code and OpenClaw?

Yes. Skills use the portable SKILL.md format, so Two Factor Authentication Best Practices works with Claude Code, OpenClaw, Codex, Hermes, and any other agent that reads SKILL.md skills.

Featured

Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Reach 56,000+ AI builders from just $0.50 a click

You only pay for clicks, never impressions - and it's far cheaper than Google Ads, with no monthly lock-in.

Advertise from $0.50/click →
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you →
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free →
CLN.Work — Stop prompting, start hiring AI employees logoCLN.Work — Stop prompting, start hiring AI employees

Turn your Claude agents into a real team — onboard them, assign tasks, and manage them like staff.

Hire AI employees →
Deploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your OpenClaw agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch OpenClaw on Hostinger in about 60 seconds and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
Deploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10 logoDeploy your Hermes agent in 60 seconds, live 24/7 — 10% off with code ZACAARON10

Launch Hermes on Hostinger in about 60 seconds, connect Telegram & Discord, and keep it live 24/7. Use code ZACAARON10 for 10% off.

Launch on Hostinger →
View on GitHub

Recommended skills

Browse all →
better-auth-best-practices logo

better-auth-best-practices

better-auth/skills

76K installsInstall
vercel-react-best-practices logo

vercel-react-best-practices

vercel-labs/agent-skills

562K installsInstall
remotion-best-practices logo

remotion-best-practices

remotion-dev/skills

433K installsInstall
supabase-postgres-best-practices logo

supabase-postgres-best-practices

supabase/agent-skills

295K installsInstall
request-refactor-plan logo

request-refactor-plan

mattpocock/skills

151K installsInstall
find-skills logo

find-skills

vercel-labs/skills

2.6M installsInstall

Browse

Skills by category

Frontend250Git198Data154Testing120Design105Docs103Security96Automation87Backend76Devops37Productivity29Mcp23

Related guides

Hand-picked reading to help you choose, install, and use agent skills.

GuideBest Security Skills For AI AgentsGuideBest Openclaw Skills 2026GuideHow To Evaluate Openclaw Skill Before Installing

Remote OpenClaw

AI agent skills directory, marketplace, and workflow hub for OpenClaw, Hermes Agent, Claude Code, Codex, and MCP-powered operator stacks.

The Agent Stack: weekly agent tooling digest, free.

Explore

  • Home
  • Skills Directory
  • Claude Code Skills
  • Codex Skills
  • MCP Clients
  • Marketplace
  • Hermes Ecosystem
  • Free guide
  • Learn
  • Blog
  • The Agent Stack (Digest)

More

  • Submit a Tool
  • Advertise
  • Playbook
  • Free Tools
  • API
  • Shipping
  • Contact
  • Terms
  • Privacy

Know a company that should advertise here? Refer them and earn 10% — up to $300 per referral.

© 2026 Remote OpenClaw
Fazier badgeFeatured on Twelve ToolsFeatured on Wired BusinessRemote OpenClaw - Featured on AI Agents DirectoryListed on Turbo0