> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getnao.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Two-factor authentication

> Add a second step after the password with an authenticator app or an emailed code, and require it for your whole organization

Two-factor authentication (2FA) adds a second step after the password: a 6-digit code from an authenticator app, or a code sent by email. It is available on nao Cloud and on self-hosted deployments, with no license required.

2FA applies to accounts that have a nao password. Members who only sign in with SSO (Google, GitHub, GitLab, Microsoft, OIDC) rely on their identity provider and never see a 2FA step in nao. An account that had a password before it was linked to SSO still counts as a password account.

## Set up 2FA on your account

1. Open **Settings** -> **Account** and find the **Two-factor authentication** card.
2. Click **Set up** and enter your password, then pick a **Two-factor method**:
   * **Authenticator app**: scan the QR code with an app like 1Password, Google Authenticator or Authy (the secret is also shown as text if you can't scan), then enter the 6-digit code it shows.
   * **Email code**: nao emails you a 6-digit code. Enter it in the dialog. This option only appears when your organization allows email codes.
3. Click **Verify and enable**.
4. Save the **10 backup codes** nao shows (use **Copy codes**). Each one lets you log in once if you lose access to your app or your email.

The card now shows **Enabled**. From there you can:

* **New backup codes**: generate a fresh set. Your previous codes stop working.
* **Disable**: turn 2FA off. Both actions ask for your password.

To switch method (for example from email codes to an authenticator app), disable 2FA and set it up again.

> [!NOTE]
>
> The **Two-factor authentication** card only appears for accounts that have a password. SSO-only accounts don't see it.

## Log in with 2FA

After your email and password, the login page asks for a code:

* Enter the 6-digit code from your authenticator app, or the code nao just emailed you (**Send a new code** sends another one).
* Click **Use a backup code** if you can't reach your second step. Each backup code works once.
* Check **Trust this device for 30 days** to skip the code on this browser for the next 30 days.

The same step applies when you authorize an MCP client or the CLI from the browser.

### CLI login

`nao` CLI commands that log in with email and password can't complete a 2FA step. For an account with 2FA on, the CLI stops with `Two-factor authentication is enabled on this account. Log in through the browser instead.` Use the browser login, which the CLI opens by default.

## Require 2FA for your organization

Org admins control 2FA from **Settings** -> **Organization Settings** -> **Two-factor authentication**:

| Toggle | What it does |
| - | - |
| **Require for all members** | Members who log in with email and password must set up 2FA before they can keep using the app. |
| **Allow email codes** | Lets members receive their code by email instead of using an authenticator app. An authenticator app is always allowed. |

When 2FA is required, a member without it sees a **Set up two-factor authentication** screen instead of the app on their next page load, with **Set up** and **Sign out** buttons. There is no grace period. Until they finish setup, the app and session-authenticated API calls answer `403`. API keys and MCP bearer tokens keep working.

Members can still disable 2FA when it is required: they land back on the setup screen, which is how they switch method.

If you turn off **Allow email codes**, members already on email codes see a message in **Settings** -> **Account** asking them to disable 2FA and set up an authenticator app.

> [!NOTE]
>
> **Allow email codes** needs outbound email. On self-hosted deployments, [configure SMTP](https://docs.getnao.io/nao-agent/self-hosting/deployment-guide.md#smtp-for-transactional-email) first: without it the toggle stays off and shows *Requires an email provider (SMTP) to be configured.*

### Members in several organizations

A user who belongs to several organizations must set up 2FA if **any** of them requires it, and can use email codes only if **all** of them allow it.

## Reset a member's 2FA

If a member loses both their second step and their backup codes, an org admin can reset it:

1. Open **Settings** -> **Members**. Members with 2FA on show a **2FA** badge.
2. Open the member's row menu and select **Reset two-factor authentication**, then confirm.

The member then logs in with their password only. If your organization requires 2FA, they are sent straight to the setup screen.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.