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.
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 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. “Passkey” should be treated as a common noun, like “password” or “email.”
Unless you’re Google, avoid requiring users to enter their username before triggering passkey authentication. While this may seem like a usability improvement, it introduces privacy and account enumeration concerns. Instead, offer passkey login upfront on the main login page.
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!