Passkeys are quickly emerging as a secure and user-friendly alternative to passwords. However, implementing them effectively requires careful planning. Here are some key do's and don'ts we've learned along the way to ensure a smooth and secure passkey integration.
Make passkeys a primary authentication method by placing a “Sign in with a passkey” button on your main login page. Additionally, enable passkey autofill on the username/email input field to streamline authentication.
Note that you need to decide whether you want to perform the 'create passkey' or 'use passkey' action on a page. This means that you can either have a “Login with a passkey” or a “Create a passkey” button, but not something like a “Continue with a passkey” button, which would work a bit like social login buttons, where it doesn't really matter whether the user wants to log in or register.
In the future, the WebAuthn API may add a 'conditional create' option for passkeys, which would enable the combined passkey button, but it is not yet available.
For now, we recommend just placing a “Login with a passkey” button on your login page and handling the creation of the passkey in an additional step during account creation after the user has entered their email address or desired username. Which brings us to the next Do on our list.
Encourage new users to create a passkey right from the onboarding process. This ensures they adopt passkeys early, making their future logins seamless and secure.
If users can create a passkey, let them decide whether they want to set up a password at all. Reducing password dependency simplifies authentication and enhances security. However, making passwords optional has usability and privacy implications. For instance, displaying a password input by default may confuse users who never set one, but hiding it until after user identification could expose privacy risks like account enumeration. Consider these factors carefully when designing your authentication flow.
Give users control over their passkeys by allowing them to:
If a returning user logs in without a passkey, prompt them to create one. Highlight the benefits—faster logins and stronger security—while ensuring there’s a “Don’t show again” option for those who prefer other methods.
When creating new passkeys, use names that help users identify where they are stored, such as:
You can use the passkey AAGUID to determine and assign a relevant name. Find out more about AAGUIDs here.
Use the excludeCredentials option to prevent users from unintentionally overwriting existing passkeys, which could lead to orphaned (zombie) passkeys stuck on their devices.
Avoid writing PassKey, Pass Key, or other variations. The word “passkey” should be treated as a common noun, like “password” or “email.”
You should avoid requiring users to enter their username before triggering passkey authentication. One of the advantages of passkeys is that they not only contain a secure and unphishable credential, but also the user ID, which enables one-click login without the user having to enter their username or email address at all. Ideally, you should therefore not hide the passkey flow behind the username entry and only trigger the passkeys afterwards, but instead offer the passkey login option on the main login page to take advantage of the “username-less” capabilities of passkeys.
Some users prefer to store their passkeys on hardware security keys rather than cloud-based solutions. Avoid limiting passkey creation to platform authenticators unless you’re absolutely certain your users won’t need other options.
Trying to determine if a user has a passkey based on cookies or local storage is flawed because:
There will 100% be situations where your cookie-based assumption is incorrect, so we've determined that it's better not to try this at all and simply offer the passkey login option to all users.
Integrating passkeys effectively requires thoughtful UX design and security considerations. By following these do's and don'ts, you can provide a seamless authentication experience while maintaining security and flexibility for your users.
Have any other lessons learned while integrating passkeys? Let us know in the Hanko Community!