2FA codes not received on Messages in macOS I use Messages on macOS (both Catalina and now Big Sur) with iCloud syncing on.
I can receive and send messages from/on macOS. Except for 2FA (two-factor authentication) codes. These codes, from any service I've used, only arrive on my iPhone, and not on any of the Mac computers I'm logged in with iCloud.
I haven't figured out a way to fix this issue. 2FA codes used to work a while ago (I used the auto-completion feature when login into Twitter or GitHub from Safari on macOS), but at some point they stopped coming in.
Sounds like you are receiving/sending iMessages on your Mac, but not SMS (used for 2FA).
In your iPhone settings, go to “Messages”, and setup “Text Message Forwarding” to your Mac.
More info on Apple Support.