Home Assistant two-factor login: how to switch on 2FA and keep a backup

Smart Home Junkie walks through turning on two-factor authentication in Home Assistant, using a TOTP authenticator app, and explains why saving the secret key matters.

The most important setting in Home Assistant almost everybody forgets!Home Assistant two-factor login: how to switch on 2FA and keep a backup. Plays from YouTube (privacy-enhanced mode).

This is our summary of Smart Home Junkie’s video, published with their permission. The full video and all credit for it are on their channel.

What the video covers

0:00
Introduction

The video introduces the importance of two-factor authentication in Home Assistant.

1:54
What you need

The video lists the requirements for setting up 2FA in Home Assistant.

2:35
How it works

The video explains the TOTP method for 2FA.

4:07
Step-by-step setup

The video guides the user through the 2FA setup process.

7:01
Testing

The video shows how to test the 2FA setup.

9:04
Backup and alternative

The video discusses the importance of having a backup for 2FA and introduces the notify module.

Many people running Home Assistant never turn on two-factor authentication, even though it takes only a few minutes. In a new 11-minute how-to, the creator Smart Home Junkie argues that a password alone is a weak defence once your Home Assistant can be reached from outside the house.

The video covers the full process: what you need, how the time-based code method works, the setup steps, a test login, and a backup option. The creator's main conclusion is that the secret key must be stored safely, because Home Assistant does not give you backup codes.

Why a password is not enough

The creator starts from a simple point. If your Home Assistant can be reached over the internet, the password is the only barrier between outsiders and your door locks, cameras and alarm panel. Reused passwords from old data breaches make this worse, because a leaked login can be tried again.

Two-factor authentication adds a second check. Even if someone has the password, they cannot get in without the code from your phone. The creator calls it one of the most overlooked settings in Home Assistant, mainly because nothing in the interface prompts you to enable it.

If you can reach Home Assistant from outside your house, that password is your entire defense.

Creator, at 0:20 in the video

What you need and how the codes work

You need a working Home Assistant installation, the login for the account you want to protect, and an authenticator app. The creator uses Authy and notes that Google Authenticator works too, as does most password manager software that supports standard time-based codes. Two-factor is set per user, so every person with an account must enable it separately.

The method is TOTP, a time-based one-time password. Home Assistant creates a secret key, which you add to your app once, usually by scanning a QR code. The app and Home Assistant then each calculate a six-digit code from that key and the current time, and the code changes roughly every 30 seconds. The secret key is effectively a second password, and Home Assistant's clock must be accurate for the codes to match.

Keep a copy of that secret key in your password manager or set up a second authenticator on another device.

Creator, at 9:59 in the video

Setup, testing and the step people skip

In the profile's security menu, the TOTP module is normally available by default. If you have written your own list of MFA modules in configuration.yaml, check that TOTP is still in it, because dropping it hides the authenticator option. Enable the module, copy the key shown under the QR code, then scan it and type the current code to confirm.

The creator advises testing before you log out of your current session. Open a private browser window, log in, and check that Home Assistant asks for a code. If valid codes are rejected, check the system clock first. The step most people skip is the backup. Home Assistant does not issue backup codes, so the creator recommends saving the secret key in a password manager or adding a second authenticator on another device.

The notify alternative

The video also covers the notify module as an option. Instead of an app, Home Assistant sends a six-digit code to a notification service such as a phone notification. It is configured in configuration.yaml with a notify entity for your phone, then enabled on the security page after a restart.

The creator points out a limitation: Home Assistant cannot confirm that the notification was delivered. If it does not arrive, you cannot log in with it, so he keeps the authenticator app as a backup.

RelatedShelly's LOQED Touch Smart Lock: strong local controlRelatedShelly Camera with Frigate: local face and plate recognition for 40 euros

Enjoying this? Get the Smart Home brief

Every Tuesday: what changed in Matter, hubs and security.

✓ Free · seven editions · one click to leave

Topics
Add us as a preferred source on GoogleSee our stories first in Google’s Top Stories.
Get alerts on big newsOnly the big news, at most once a day. No email, no account.