If you have an Android phone or tablet, then you must use Google Authenticator. Its an app that can generate the codes necessary for 2FA (Two Factor Authentication) to log into Google, Microsoft, Github and other online services. This is far easier than receiving a code through SMS. Give it a try!
Google Authenticator can be installed from here.
Tried with: Google Authenticator 2.49, Android 4.4.2 and Moto G