How to setup 2FA for UniFi
To set up 2FA for direct logins in UniFi
Create an account on Ubiquiti’s website https://account.ui.com/
Enable 2FA on that account https://help.ubnt.com/hc/en-us/articles/115012986607-How-to-Enable-Two-Factor-Authentication#2
Enable Settings > Remote Access > Local login with UBNT account on your UniFi server
Create an Admin or Super Admin account in UniFi using the same username, email, and password as your UI account
Now when you log in directly to UniFi you will be prompted for 2FA