If you ever wondered exactly what all steps happen under the hood when you use a 2FA Authenticator app like Google Authenticator / Authy etc, I have written a detailed blog post with a step by step explanation (as I was making my own 2FA app recently).