Two-factor authentication
Two-factor authentication is an extra layer of security for your Apple ID designed to ensure that you’re the only person who can access your account, even if someone knows your password.
To see whether your Apple ID has two-factor authentication turned on, choose Apple menu > System Settings, then click [your name] in the sidebar. Click Password & Security, then turn on Two-Factor Authentication.
See the Apple Support article Two-factor authentication for Apple ID.