Here's what I've learned:
Old MacOS versions up to 10.11 El Capitan don't have 2 factor authentication (2FA) and thus cannot use an Apple ID with 2FA to Login to the App Store.
New macOS versions, starting from High Sierra 10.13 can only be upgraded through the AppStore.
But... Apple has provided a download page where you can download the older versions of macOS, just by using a browser.
Starting from Sierra 10.12, 2FA is available.
After downloading and installing Sierra, you wil be able to login to the AppStore using your 2FA Apple ID.
From there on, you can use the AppStore to upgrade to the newer version of macOS
in short:
IF
- you have a macOS below Sierra 10.12 you will not be able to login to the AppStore using your AppleID with 2FA enabled
Then:
- Go to How to download and install macOS - Apple Support
- Download Sierra 10.12
- Install Sierra 10.12
- Login with your Apple ID
- If you want to upgrade to highers macOS versions, go to above link and choose the higher macOS version you want, that will download and install the package from the AppStore.
!!! Always check whether your Mac can run the macOS version you select before installing !!!