# MFA enforcement

> mfa_satisfied() for restrictive policies: true when the caller has no verified factor, or verified one in this session (aal2).

- Category: Identity & access
- Module: `mfa`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/mfa
- Page: https://bettersupabase.com/blocks/mfa

## Install

```bash
npx better-supabase add mfa
```

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Modes: "managed". The default is "managed".
    mfa: { mode: "managed" },
  },
});
```

## Client

The React hooks are the registry item `@better-supabase/use-mfa` (`npx shadcn add @better-supabase/use-mfa`). They return data and actions and render no UI. Source: https://github.com/ScaleDockHQ/better-supabase/blob/main/packages/registry/items/hooks/use-mfa.ts

## Recipes

- [Two-factor setup](https://bettersupabase.com/recipes/mfa-setup.md): A card that enrolls an authenticator app with a QR code, verifies the first code and removes the factor.
