George47
The principal reason a 2FA code doesn't work is that your computer's time is slightly off. 2FA codes are generated by your device using the current time, and they change about every thirty seconds. If your computer clock drifts/differs from the server, a wrong code will be generated. Another way to put it is with the clocks on your computer, and the server differs, and a mismatch in the 2FA codes occurs, resulting in an inability to log in.
I would check and make sure the time is set correctly on your device. Does it automatically update itself? If not, try enabling automatic updating. I like to use https://time.is to check my device time. Nowadays, most all devices set their time automatically. However, hiccups still happen. I have had to toggle my "Set time automatically" settings from On > Off > On.
Also, giving your device a restart may help alleviate any transient issues. The last few users that I helped with this reported that a restart solved their issue. Please be sure to give that a go.