When you enter a 2-factor authentication code and it immediately returns you back to the login form. This problem is most commonly seen when a password manager, such as LastPass is set to AutoFill.
To resolve this issue, you will need to turn off Autofill in your password manager.