Clerk supports passwordless authentication, which lets users sign in and sign up without having to remember a password. During sign-in, users will be asked to enter their identifier (email address or phone number) to receive a one-time password (OTP), also referred to as a one-time code, and complete the authentication process.
Arguably, passwordless authentication provides greater security and a better user experience than traditional passwords. However, it is not without its downsides, and often still boils down to the email providers "knowledge based factor" instead of yours.
There are multiple ways to set up passwordless authentication in Clerk such as using Clerk Components, or by creating a custom flow using Clerk's SDKs.
The rest of this guide will explain how to set up passwordless authentication using any of the above methods. Before you start, you will need to configure your instance to allow passwordless sign-ins.
To enable passwordless authentication, you need to configure your instance to allow passwordless sign-ins. You can do this through the Clerk Dashboard or by creating a custom flow using the Clerk API.
Passwordless authentication can be configured through the Clerk Dashboard. Go to User & Authentication > Email, Phone, and Username. In the Authentication strategies section of this page, choose one of the available passwordless authentication strategies that send one-time codes.
For more information on how to configure passwordless authentication, check out the Sign-in and sign-up options guide.
In case one of the above integration methods doesn't cover your needs, you can make use of lower-level commands and create a completely custom passwordless authentication flow.
Warning
You still need to configure your instance in order to enable passwordless authentication, as described at the top of this guide.
The passwordless sign-up flow is a process that requires users to provide their authentication identifier (email address or phone number) and a one-time code that is sent to them. The important thing to note here is that a user's email address or phone number needs to be verified before the registration is completed.
A successful sign-up consists of the following steps:
Initiate the sign-up process by collecting the user's identifier (email address or phone number).
Prepare the identifier verification.
Attempt to complete the identifier verification.
Let's see the above in action. If you want to learn more about sign-ups, check out our documentation on Clerk's sign-up flow.
Next.js
React
JavaScript
App Router
You can also verify your users via their email address. There's two additional helper methods: prepareEmailAddressVerification and attemptEmailAddressVerification that work the same way as their phone number counterparts do. You can find all available methods in the SignUp object documentation.
The passwordless sign-in flow is a process that requires users to provide their authentication identifier (email address or phone number) and subsequently a one-time code that is sent to them. We call this one-time code the first factor of authentication.
So, in essence, when you want to authenticate users in your application, you need to
Initiate the sign-in process by collecting the user's authentication identifier.
Prepare the first factor verification.
Attempt to complete the first factor verification.
Let's see the above in action. If you want to learn more about sign-ins, check out our documentation on Clerk's sign-in flow.
Next.js
React
JavaScript
App Router
You can also achieve passwordless sign-ins with an email address. Simply pass the value email_code as the first factor strategy. Just make sure you've collected the user's email address first. You can find all available methods in the SignIn object documentation.