The two-step authentication commonly required by various services is simply an SMS text message. As such it is the same as any other text message.
Continuity is the term Apple uses for the service that incorporates the ability to forward those SMS text messages from an iPhone to your Mac via its Messages app. That highly challenging technological feat is so straightforward and seamless it's easy to lose sight of the fact it wouldn't be possible without Continuity.
It's even better when the Mac (or the iPhone) automatically offers to fill in that code: Autofill security codes from your iPhone in Safari on Mac. For a video demonstration, watch Automatic Strong Passwords and Security Code AutoFill. It simplifies what used to be an enormous hassle.
I think I literally jumped for joy when I saw that demonstration.
For reasons I don't understand not all services work with it. Most do though.