Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Create and Delete Users - Node SDK

On this page

  • Create a User
  • Delete a User

For most authentication methods, Realm automatically creates a user account the first time a user authenticates. The only exception is email/password authentication. When you use email/password authentication, you must register and confirm a user before the user can authenticate to a Realm application.

Important

Google and Apple Account Deletion Requirements

Google and Apple require that applications listed through their respective App Stores must give any user who creates an account the option to delete the account. Whether you use an authentication method where you must manually register a user, such as email/password authentication, or one that that automatically creates a user, such as Sign-In with Apple, you must implement user account deletion.

New in version 10.13.0.

Call the App.deleteUser() on a user object to delete the user's account from your Realm application. This deletes the account from the server in addition to clearing local data.

await app.deleteUser(app.currentUser);

To use your app in the future, the user must sign up for a new account. They can use the same credentials (depending on the authentication provider), but will not have the same User ID as their deleted account.

Important

Deleting All User Data

Deleting a user only deletes the user object, which may contain associated metadata from the associated auth provider. This does not delete custom user data or other user data that your app stores in a linked collection or external services.

Use the Authentication Trigger DELETE event to programmatically clean up other data when you delete a user. For example, you can delete the user's data from your custom user data collection or another service.

Google and Apple require that you disclose data retention and deletion policies to your application customers and give them a way to request user data deletion. If you collect additional user data, you must implement your own methods or processes to delete that data.

Back

Manage Users