Can I use a security key such as YubiKey to sign into Google on Safari?

Solution 1:

First, I assume you are using YubiKey 4 with U2F support.

Safari does not support U2F natively, but if you have Safari 10, you can add the plugin Safari-FIDO-U2F available from blahgeek on GitHub.

The author confirms that the plugin works with some of the websites (with some hacking required to show up to the server as Chrome):

  • Github Account Two-factor authentication
  • Dropbox Account Security
  • Fastmail

but also warns it does not work with Google Account (although it does with Google's demo site).

So for now the answer is you cannot use U2F to login to Google, but it might change in future.

Solution 2:

Safari is working on support for these keys–it is currently supported as an Experimental Feature in Safari 12.1 and available in Safari Technology Preview.

Update on May 31st, 2019: The latest Safari Technology Preview enables this by default, no longer making it an Experimental Feature. The next major Safari release should support this.

Solution 3:

Safari 13, released on 2019-09-20, now supports FIDO2 USB security keys on macOS.

From the Release Notes:

Added support for FIDO2-compliant USB security keys with the Web Authentication standard in Safari on macOS.