Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Manage Email/Password Users - Java SDK

On this page

  • Register a New User Account
  • Confirm a New User's Email Address
  • Reset a User's Password
  • Send a Password Reset Email
  • Run a Password Reset Function

When you have enabled the email/password provider in your App, you can register a new account, confirm an email address, and reset a user's password from client code.

To register a new user, pass a user-provided email and password to the registerUser() or registerUserAsync() methods of your Realm App's EmailPasswordAuth instance:

To confirm a newly-created user, pass a confirmation token and tokenId to the confirmUser() or confirmUserAsync() methods of your Realm App's EmailPasswordAuth instance:

Tip

To access the token and tokenId values sent in the user confirmation email, you can use a custom confirmation email subject containing a deep link.

To reset a user password in Sync, you can either:

  • Send a password reset email

  • Run a password reset function

Select your preferred password reset method by going to:

  1. Your App

  2. Authentication

  3. Authentication Providers

  4. Email/Password - and press the EDIT button

To reset a user's password, first send the user a password reset email with sendResetPasswordEmail() or sendResetPasswordEmailAsync():

Password reset emails contain two values, token and tokenId. To complete the password reset flow, prompt the user to enter a new password and pass the token and tokenId values along with the new password value to your Realm App's EmailPasswordAuth instance's resetPassword() or resetPasswordAsync() methods:

Tip

To access the token and tokenId values sent in the password reset email, you can use a custom password reset email subject containing a deep link.

When you configure your app to run a password reset function, you'll define the function that should run when you call callResetPasswordFunction() or callResetPasswordFunctionAsync() from the SDK. This function can take a username, a password, and any number of additional arguments. You can use these arguments to specify details like security question answers or other challenges that the user should pass to successfully complete a password reset.

You might prefer to use a custom password reset function when you want to define your own password reset flows. For example, you might send a custom password reset email from a specific domain, or through a service other than email.

Tip

See also:

For more information on how to define a custom password reset function in your App, see: Run a Password Reset Function.

← Custom User Data