Docs Menu

Create and Delete Users - React Native 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.

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.

Apple requires 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.

←  Connect to a MongoDB Realm Backend App - React Native SDKAuthenticate Users - React Native SDK →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.