Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Delete Users - Kotlin SDK

On this page

  • Remove a User
  • Delete a User

This page describes how to remove and delete authenticated users from your Atlas App Services App. For more information on how to create and authenticate users, see Create and Authenticate Users - Kotlin SDK.

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.

To remove a User object from your client app, call the remove method on a user:

val app = App.create(YOUR_APP_ID) // Replace with your App ID
runBlocking {
// Log user in
val user = app.login(credentials)
// Work with logged-in user ...
// Remove the user from the device
// If the user is logged in, they are logged out first
// DOES NOT delete user from the App Services App
user.remove()
}

The user.remove() method acts as follows:

  • Does not delete the User object from the Atlas App Services App.

  • Logs the user out if they are logged in.

  • Deletes synced realms associated with the user from the device.

  • Sets the User.State to REMOVED.

Because removing a user deletes any synced realms owned by the user, you should only call this method after closing the user's realms.

To permanently delete a User object from both your client app and the Atlas App Services App, call the delete method on a logged-in user:

val app: App = App.create(YOUR_APP_ID)
runBlocking {
// Log user in
val user = app.login(credentials)
// Work with logged-in user ...
// Delete the logged-in user from the device
// and the Atlas App Services App
user.delete()
}

The user.delete() method performs the following:

  • Deletes synced realms associated with the user from the device.

  • deletes the User object from the Atlas App Services server

  • sets the User.State to REMOVED

Because this method deletes any synced realms owned by the user, you should only call this method after closing the user's realms.

If the deleted user wants 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 a User Doesn't Delete User Metadata

Deleting a user only deletes the user object, which may contain associated metadata. This does not delete custom user data or user-entered data from your application. 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 Multi-User Apps

Next

Manage Custom User Data