# Turn on two-factor sign-in

Add a code from an authenticator app to your password, and require two-factor sign-in for every member of your organization.

Any app that shows six-digit time-based codes (TOTP) works: 1Password, Google Authenticator,
Microsoft Authenticator, Authy and others. Each person turns it on for their own account. An account
that signs in through single sign-on has no password and no two-factor setting here; its identity
provider's rules apply.

## Prerequisites

- Your account's password. No IAM action is needed for your own account.
- To require it for the organization: `iam:UpdateOrganizationAuthPolicy`, and two-factor sign-in on
  for your own session first.

## Turn it on for your account

**Console**
1. Open [My account](/account). Under **Two-factor sign-in**, choose **Turn on**.
2. Under **Confirm it's you**, enter your password and choose **Continue**.
3. Under **Scan with your authenticator app**, scan the QR code, or type the **setup key** shown
   under it into the app.
4. Enter the six-digit code the app shows and choose **Turn on**.
5. Under **Your recovery codes**, choose **Download** or **Copy all**. The ten codes are shown only
   now.
6. Select **I have saved these codes**, then choose **Done**.

## Result

Signing in with your password now asks for a code from the app. Turning it on signs out your other
sessions; the browser you use stays signed in. A recovery code (format `xxxxx-xxxxx`) stands in for
the app once each: the second step of the [sign-in page](/login) has a link for it, "Lost your
device? Use a recovery code".

Codes are SHA-1, six digits, 30-second steps; the current step and one either side are accepted,
and a code is accepted once. **New recovery codes** replaces the whole set, and **Turn off**
removes the app and signs out your other sessions. Both ask for your password and a current code.

Turning it on or off, and using a recovery code, is mailed to you, unless you sign in as an IAM
user (see [Manage your sessions](manage-your-sessions.md)).

## Require it for the organization

**Console**
1. Open [Organization settings](/settings).
2. Under **Sign-in security**, turn on **Require two-factor sign-in**. It saves at once.

From then on, a member whose session did not pass a second factor (an authenticator code, a
passkey or a recovery code) is sent to set one up before they
use the console, and API requests from such a session are refused with 403. Sessions that signed in
through single sign-on, access keys and connected apps are not affected. With `iam:ListMembers`,
the setting also lists the members who have not set it up. Each change is recorded in the audit
log.

## If it is refused

- 409 `Turn on two-factor sign-in for your own account first, so the requirement cannot lock you out.`
  The console says the same beside the switch and does not send the change.
- 400 `The password is not right.`
- 400 `That code is not right. Check the time on your device and try again.`, or
  `That code has already been used. Wait for the next one.`

## Related

- [Add a passkey](add-a-passkey.md) · [Manage your sessions](manage-your-sessions.md)
- [Manage console access](manage-console-access.md): remove an IAM user's lost second factor.
