AutoFill security codes from your iPhone in Safari on Mac
You can use the security codes sent to your iPhone (iOS 8.1 or later) to automatically sign in to webpages on your Mac.
Set up Text Message Forwarding on your iPhone
On your iPhone, go to Settings > Messages > Text Message Forwarding.
Tap your Mac.
AutoFill security codes on your Mac
In the Safari app on your Mac, sign in to a webpage that typically sends a security code to your iPhone.
When you’re prompted to enter the security code, Safari provides the information on your Mac.
Click the security code from Safari.