Build a custom authentication flow using passkeys
Clerk supports passwordless authentication via passkeys, enabling users to sign in without having to remember a password. Instead, users select a passkey associated with their device, which they can use to authenticate themselves.
This guide will teach you how to use Clerk's API to build custom flows for creating, signing users in with, and managing passkeys.
Create user passkeys
To create a passkey for a user, you must call User.createPasskey()
as shown in the following example:
Sign a user in with a passkey
To sign a user into your Clerk app with a passkey, you must call SignIn.authenticateWithPasskey()
. This method allows users to choose from their discoverable passkeys, such as hardware keys or passkeys in password managers.
Rename user passkeys
Clerk generates a name based on the device associated with the passkey when it's created. Sometimes users may want to rename a passkey to make it easier to identify.
To rename a user's passkey in your Clerk app, you must call the update()
method of the passkey object as shown in the following example:
Delete user passkeys
To delete a user's passkey from your Clerk app, you must call the delete()
method of the passkey object as shown in the following example:
Feedback
Last updated on