Manage Email/Password Users - React Native SDK
On this page
Register a New User Account
To register a new email/password user, pass the user's email address and desired password to EmailPasswordAuth.registerUser(). The email address must not be associated with another email/password user and the password must be between 6 and 128 characters.
You must confirm a new user's email address before they can log in to your app.
Confirm a New User's Email Address
New users must confirm that they own their email address before they can log in to your app unless the provider is configured to automatically confirm new users.
Complete a User Confirmation
You need a valid token
and tokenId
for a registered user in order to
confirm them and allow them to log in. These values are available in different
places depending on the provider configuration:
- If the provider is set to send a confirmation email, the
token
andtokenId
values are included as query parameters in the Email Confirmation URL. - If the provider is set to run a confirmation function, the
token
andtokenId
values are passed to the function as arguments.
To confirm a registered user, pass a valid token
and tokenId
to
EmailPasswordAuth.confirmUser().
Retry User Confirmation Methods
The SDK provides methods to resend user confirmation emails or retry custom confirmation methods.
Resend a Confirmation Email
If the provider is configured to send a confirmation email, Realm automatically sends a confirmation email when a user registers. The email contains a link to the configured Email Confirmation URL with a token that is valid for 30 minutes after the email is sent. If a user did not receive the initial email or didn't click the confirmation link in time, you can use the SDK to send a new confirmation email to the user.
To send a new confirmation email to a user, pass their email address to EmailPasswordAuth.resendConfirmationEmail().
Retry a User Confirmation Function
To re-run your custom confirmation function, call the retryCustomConfirmation()
method
with the user's email address:
Reset a User's Password
Send a Password Reset Email
To send a password reset email (if the provider is configured to do so), call EmailPasswordAuth.sendResetPasswordEmail(). The email contains a link to the configured Password Reset URL.
Call a Password Reset Function
To run a password reset function (if the provider is configured to do so), pass the user's email address, new password, and any additional function arguments to EmailPasswordAuth.callResetPasswordFunction().
Complete a Password Reset
Once a user requests a password reset, either by sending a password reset
email or calling a password reset
function, Realm generates a pair of unique
token
and tokenId
values that they can use to complete the password
reset within 30 minutes of the initial request.
To complete the password reset, pass the token
, tokenId
, and new
password to EmailPasswordAuth.resetPassword().