-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathdelete-users.txt
75 lines (54 loc) · 2.43 KB
/
delete-users.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.. meta::
:robots: noindex, nosnippet
.. _kotlin-delete-users:
.. _kotlin-creating-and-deleting-users:
=========================
Delete Users - Kotlin SDK
=========================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
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 :ref:`<kotlin-authenticate-users>`.
.. include:: /includes/tip-acct-deletion-reqs.rst
.. _kotlin-remove-a-user:
Remove a User
-------------
To remove a ``User`` object from your client app, call the `remove
<{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-user/remove.html>`__
method on a user:
.. literalinclude:: /examples/generated/kotlin/AuthenticationTest.snippet.remove-user.kt
:language: kotlin
The ``user.remove()`` method acts as follows:
- *Does not* delete the ``User`` object from the Atlas App Services App.
- :ref:`Logs the user <kotlin-logout>` out if they are logged in.
- Deletes synced realms associated with the user from the device.
- Sets the
`User.State <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-user/-state/index.html>`__
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.
Delete a User
-------------
To permanently delete a ``User`` object from both your client app
*and* the Atlas App Services App, call the `delete
<{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-user/delete.html>`__
method on a logged-in user:
.. literalinclude:: /examples/generated/kotlin/AuthenticationTest.snippet.delete-user.kt
:language: kotlin
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 <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-user/-state/index.html>`__
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.
.. include:: /includes/warning-delete-user-metadata.rst