If you have two-factor authentication enabled but don't have your phone nearby, you can use one of these desktop apps to get your code.
Source: ADnet
Source Link: https://www.zdnet.com/article/how-to-get-2fa-codes-on-your-desktop-when-your-phone-is-mia/