I use two-factor authentication with my Apple ID. This week, all my devices have been forced to enter the Apple ID password again. Not sure why. I did log in and check if there was anything suspicious with my Apple ID but there was not.
I have a 2006 MacBook Pro, a big metal thing. I use this for specific purposes. I hadn't booted it for a few weeks, so I fired it up. It asked for the Apple ID password like all my other devices, but this time I got the message on my phone asking if I would allow it, and yes I did. Then I got the six digit code on my phone. But my MacBook is so old it doesn't have the mechanisms to ask for the code, it just keeps asking for the Apple ID password. I have had this happen before, but I couldn't remember at first what I did.
After a little experimenting, I remembered what to do.
In the password box, I typed the Apple ID password followed immediately by the six digit code, no spaces. Then I pressed Enter and the password and code were checked and it was all good. So I must remember that for the future.