You can use Two Factor Authentication (2FA) on Mastodon by going to:
Preferences > Account > Two Factor Auth > Click "Set Up" and follow the instructions
It is compatible with TOTP authentication apps such as Aegis Authenticator, Google Authenticator and lots of others.
@feditips Looks like this may be server dependent. I am on mas.to, and I do not see 2FA option in Account menu :(
@feditips update. I found it and enabled it.