Most of us are used to logging into different accounts using a password. For years this has been the norm, but passwords also face other security issues:

Would it not be simpler to move towards a more passwordless login? A place where we don't have to remember or enter passwords to gain access to our accounts? One such passwordless solution is WebAuthn.

What is WebAuthn? ๐Ÿ˜…

The Web Authentication API (also known as WebAuthn) is an API that enables strong authentication with public-key cryptography, enabling passwordless authentication and/or secure second-factor authentication without SMS texts.

Let's break that down to quickly understand:

It is a specification written by the W3C and FIDO, with the participation of Google, Mozilla, Microsoft, Yubico, and others. Web Authentication works hand in hand with other industry standards such as Credential Management Level 1 and FIDO 2.0 Client to Authenticator Protocol 2.

How Does It Work? ๐Ÿค”

So like every other login situation:

Now what we don't see is a lot of what goes on in the background to facilitate this process. Let me explain a little more.

Registration Flow

In this process, a new set of key credentials are created against the username entered by the user. This key credential is the crux of the process which enables us to make sure this authentication is in a passwordless manner.

There is a simple 8 step process that takes place:

  1. A user clicks on the register button on a site on their browser (user agent)
  2. The authenticating server (relying party) issues a challenge (a random set of data sent as an array) to the user's browser to be able to enable WebAuthn login
  3. The browser sends this challenge to the authenticator device
  4. The authenticator device then prompts the user to authenticate themselves. This would be different based on the device. e.g - Touch ID on a Macbook or touching a YubiKey
  5. Once the user authorizes the authenticator device, the authenticator will then create a new key pair (a public and private key) and will then use the private key to sign the challenge
  6. The authenticator device will then return the signed challenge, the public key as well as details pertaining to the process back to the authenticating server
  7. The authenticating server will then confirm the authenticity of the private key by using the public key to ensure the challenge was signed by the private key
  8. It will then store the received details against the username for future use and respond that the user is registered

Authentication Flow

Authentication is a similar process where the above-generated credentials are used to verify the user's identity by going through a signed challenge process again.

There is a simple 8 step process that takes place:

  1. A user clicks on the login button on a site on their browser (user agent) and enters their username
  2. The authenticating server (relying party) issues a challenge (a random set of data sent as an array) to the user's browser along with the saved private key ID registered with the username
  3. The browser sends this challenge & private key ID to the authenticator device
  4. The authenticator device then prompts the user to authenticate themselves. This would be different based on the device. e.g - Touch ID on a Macbook or touching a YubiKey
  5. Once the user authorizes the authenticator device, the authenticator will then retrieve the generated key pair saved on it with the provided private key ID and will then use the private key to sign the challenge
  6. The authenticator device will then return the signed challenge as well as details pertaining to the process back to the authenticating server
  7. The authenticating server will then confirm the authenticity of the private key by using its saved public key to ensure the challenge was signed by the private key
  8. It will then log the user in

That Sounds Awesome ๐Ÿ˜ฎ

Absolutely. Let's quickly see some of the benefits:

and lastly, NO MORE PASSWORDS

All that being said, it does have some issues which are still to be solved:

Conclusion

WebAuthn is a much more secure authentication flow that is phishing resistant and only stores public data on a database, with most private data generally stored on the hardware authenticator only. It makes use of asymmetric cryptography to do a user check and provides a much better UX compared to the existing login flow.

Currently, WebAuthn is majorly being driven as two-factor authentication or universal 2nd-factor workflow but could possibly replace password-based login in the future.

Hopefully, this article enables you to understand what WebAuthn is and how it works.

Thanks for reading! I really hope that you find this article useful. I invite you to participate in the discussion in the comments below, I'm always interested to know your thoughts and happy to answer any questions you might have in your mind. If you think this post was useful, please like the post to help promote this piece to others.

Thanks for reading! :)

P.S. Feel free to connect with me on LinkedIn or Twitter.

Appendix

The following have been great material that helped me write this article:

Also published here.