Privy enables users to login to your application with SMS or email. With Privy, your application can verify ownership of a user’s email address or phone number to send them notifications, campaigns, and more to keep them activated.
Enable email authentication in the Privy Dashboard before implementing this feature.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
Whether to disable the ability to sign up with the email address.
A promise that resolves when the code is sent.
The one-time passcode sent to the user’s email address.
A promise that resolves when the user is logged in.
Track the state of the OTP flow via the state
variable returned by the
useLoginWithEmail
hook.
The current state of the OTP flow.
The error that occurred during the OTP flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after a successful login or to handle errors that occur during the flow.
onComplete
The user object corresponding to the authenticated user.
Whether the user is a new user or an existing user.
Whether the user entered the application already authenticated.
The method used by the user to login.
The account corresponding to the loginMethod used.
onError
The error that occurred during the login flow.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
Whether to disable the ability to sign up with the email address.
A promise that resolves when the code is sent.
The one-time passcode sent to the user’s email address.
A promise that resolves when the user is logged in.
Track the state of the OTP flow via the state
variable returned by the
useLoginWithEmail
hook.
The current state of the OTP flow.
The error that occurred during the OTP flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after a successful login or to handle errors that occur during the flow.
onComplete
The user object corresponding to the authenticated user.
Whether the user is a new user or an existing user.
Whether the user entered the application already authenticated.
The method used by the user to login.
The account corresponding to the loginMethod used.
onError
The error that occurred during the login flow.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
A promise that resolves to an object with a success property indicating if the code was sent successfully.
The one-time passcode sent to the user’s email address.
The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly.
Whether to disable the ability to sign up with the email address.
The user object returned by the login process.
The state variable returned from useLoginWithEmail will always be one of the following values.
The current state of the email login flow.
The error that occurred during the email login flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after an OTP has been sent, after a successful login, or to handle errors that occur during the flow.
onSendCodeSuccess
The email the code was sent to.
onLoginSuccess
The PrivyUser returned by loginWithCode.
Whether the user is a new user or an existing user.
onError
The error that occurred during the login flow.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
Nothing, indicating success.
An error if sending the code fails.
The one-time passcode sent to the user’s email address.
The user’s email address.
The authenticated Privy user
An error if logging the user in is unsuccessful.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
A Result object that indicates whether the operation was successful. Returns Result.success if the code was sent successfully, or Result.failure if there was an error.
The one-time passcode sent to the user’s email address.
(Optional) The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly. If email is omitted, the email from sendCode will be used.
A Result object containing the PrivyUser if successful, or an error if the operation failed.
To authenticate a user via their email address, use the Privy client’s Email
handler.
The email address of the user to log in.
A Task that resolves to a boolean indicating whether the code was sent successfully.
The user’s email address.
The one-time passcode sent to the user’s email address.
A Task that completes when the user is successfully authenticated, or throws an exception if authentication fails.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
A Result object that indicates whether the operation was successful. Returns Result.success if the code was sent successfully, or Result.failure if there was an error.
The one-time passcode sent to the user’s email address.
(Optional) The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly. If email is omitted, the email from sendCode will be used.
A Result object containing the PrivyUser if successful, or an error if the operation failed.
Privy enables users to login to your application with SMS or email. With Privy, your application can verify ownership of a user’s email address or phone number to send them notifications, campaigns, and more to keep them activated.
Enable email authentication in the Privy Dashboard before implementing this feature.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
Whether to disable the ability to sign up with the email address.
A promise that resolves when the code is sent.
The one-time passcode sent to the user’s email address.
A promise that resolves when the user is logged in.
Track the state of the OTP flow via the state
variable returned by the
useLoginWithEmail
hook.
The current state of the OTP flow.
The error that occurred during the OTP flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after a successful login or to handle errors that occur during the flow.
onComplete
The user object corresponding to the authenticated user.
Whether the user is a new user or an existing user.
Whether the user entered the application already authenticated.
The method used by the user to login.
The account corresponding to the loginMethod used.
onError
The error that occurred during the login flow.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
Whether to disable the ability to sign up with the email address.
A promise that resolves when the code is sent.
The one-time passcode sent to the user’s email address.
A promise that resolves when the user is logged in.
Track the state of the OTP flow via the state
variable returned by the
useLoginWithEmail
hook.
The current state of the OTP flow.
The error that occurred during the OTP flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after a successful login or to handle errors that occur during the flow.
onComplete
The user object corresponding to the authenticated user.
Whether the user is a new user or an existing user.
Whether the user entered the application already authenticated.
The method used by the user to login.
The account corresponding to the loginMethod used.
onError
The error that occurred during the login flow.
To authenticate your users with a one-time passcode (OTP) sent to their email address, use the useLoginWithEmail
hook.
The email address of the user to log in.
A promise that resolves to an object with a success property indicating if the code was sent successfully.
The one-time passcode sent to the user’s email address.
The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly.
Whether to disable the ability to sign up with the email address.
The user object returned by the login process.
The state variable returned from useLoginWithEmail will always be one of the following values.
The current state of the email login flow.
The error that occurred during the email login flow.
You can optionally pass callbacks into the useLoginWithEmail
hook to run custom logic after an OTP has been sent, after a successful login, or to handle errors that occur during the flow.
onSendCodeSuccess
The email the code was sent to.
onLoginSuccess
The PrivyUser returned by loginWithCode.
Whether the user is a new user or an existing user.
onError
The error that occurred during the login flow.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
Nothing, indicating success.
An error if sending the code fails.
The one-time passcode sent to the user’s email address.
The user’s email address.
The authenticated Privy user
An error if logging the user in is unsuccessful.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
A Result object that indicates whether the operation was successful. Returns Result.success if the code was sent successfully, or Result.failure if there was an error.
The one-time passcode sent to the user’s email address.
(Optional) The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly. If email is omitted, the email from sendCode will be used.
A Result object containing the PrivyUser if successful, or an error if the operation failed.
To authenticate a user via their email address, use the Privy client’s Email
handler.
The email address of the user to log in.
A Task that resolves to a boolean indicating whether the code was sent successfully.
The user’s email address.
The one-time passcode sent to the user’s email address.
A Task that completes when the user is successfully authenticated, or throws an exception if authentication fails.
To authenticate a user via their email address, use the Privy client’s email
handler.
The email address of the user to log in.
A Result object that indicates whether the operation was successful. Returns Result.success if the code was sent successfully, or Result.failure if there was an error.
The one-time passcode sent to the user’s email address.
(Optional) The user’s email address. Though this parameter is optional, it is highly recommended that you pass the user’s email address explicitly. If email is omitted, the email from sendCode will be used.
A Result object containing the PrivyUser if successful, or an error if the operation failed.