# Two-Factor Authentication

Two-factor authentication (2FA) adds a second step to sign-in, on top of your password. Once enabled, logging in requires both your password and a single-use code from an authenticator app, so your account stays protected even if your password is leaked.

CloudAMQP's two-factor authentication is based on the [Time-based One-Time Password (TOTP)](https://en.wikipedia.org/wiki/Time-based_one-time_password) standard, so it works with any authenticator app, such as [Google Authenticator](https://support.google.com/accounts/answer/1066447), [Authy](https://authy.com/), 1Password, or Microsoft Authenticator.

Two-factor authentication is optional for individual users, but a team admin can [require it for the whole team](/docs/two-factor-authentication/#enforce-two-factor-authentication-for-a-team).

### Enable two-factor authentication

1. Open Account Settings from the user menu. Next to Two-Factor Authentication, click Enable Two-Factor. Account settings are locked by default, so unless you've confirmed your password recently you'll be asked to re-enter it before making changes — you can also lock them again at any time with Lock settings. Once confirmed, settings stay unlocked for about 15 minutes. ![CloudAMQP account settings with the Enable Two-Factor option](/img/docs/2fa-account-settings.png)
2. Open your authenticator app and scan the QR code. If you can't scan it, reveal the security code and enter it manually instead. ![Scan the QR code with an authenticator app to set up two-factor authentication](/img/docs/2fa-setup.png)
3. Enter the six-digit code shown by your authenticator app and click Verify token and enable two-factor authentication.
4. Two-factor authentication is now enabled on your account. From here you can also disable it again, which requires a valid code. ![Two-factor authentication enabled confirmation](/img/docs/2fa-enabled.png)

### Signing in with two-factor authentication

After enabling 2FA, each sign-in prompts for a one-time code once you've entered your password. Open your authenticator app and enter the current code to continue.

![Two-factor authentication prompt shown during sign-in](/img/docs/2fa-login-prompt.png)

Tick Remember this device to skip the code on that browser for a while. If you have a backup phone number registered, you can also request the code by SMS from this screen.

### Backup phone number

Once 2FA is enabled you may add a backup phone number. It lets you receive a code by SMS if you ever lose access to your authenticator app. An authenticator app remains the recommended primary method — a phone number on its own is not considered sufficient.

### Disable two-factor authentication

To turn 2FA off, open Account Settings → Two-Factor and enter a current code in the Disable two-factor authentication section. Any backup phone number is removed at the same time.

### Enforce two-factor authentication for a team

Teams can require two-factor authentication at their own discretion. A team admin enables it under Team → Settings by turning on Enforced Two-factor authentication.

![Team settings with the Enforced Two-factor authentication toggle](/img/docs/2fa-team-enforcement.png)

While enforcement is on, members who haven't set up 2FA lose access to the team until they enable it, so let your team know before turning it on.

### Lost your device?

If you lose access to your authenticator app and don't have a backup phone number, contact us at [support@cloudamqp.com](mailto:support@cloudamqp.com) and we'll help you regain access to your account.
