@@ -12,6 +12,55 @@ Multi-User Applications - Node.js SDK
12
12
:depth: 2
13
13
:class: singlecol
14
14
15
+ The Realm SDK allows multiple :ref:`users <user-accounts>` to be logged in to an
16
+ app simultaneously on a given device. {+service-short+} client applications run
17
+ in the context of a single active user even if multiple users are logged in
18
+ simultaneously. You can quickly switch between authenticated users without
19
+ requiring them to log in again.
20
+
21
+ .. important::
22
+
23
+ **Any logged in user may become the active user without re-authenticating.**
24
+ Depending on your app, this may be a security vulnerability. For example, a
25
+ user on a shared device may switch to a coworker's logged in account without
26
+ providing their credentials or requiring their explicit permission. If your
27
+ application requires stricter authentication, avoid switching between users
28
+ and prefer to explicitly log the active user out before authenticating
29
+ another user.
30
+
31
+ User Account States
32
+ ~~~~~~~~~~~~~~~~~~~
33
+
34
+ When a user first logs in through a {+service-short+} SDK on a given device or
35
+ browser, the SDK saves the user's information and keeps track of the user's
36
+ state on the device. The user's data remains on the device, even if they log
37
+ out, unless you actively :ref:`remove the user <dotnet-remove-user>`.
38
+
39
+ The following states describe an on-device user at any given time:
40
+
41
+ - **Authenticated:** any user that has logged in on the device
42
+ and has not logged out or had its session revoked.
43
+
44
+ - **Active**: a single authenticated user that is currently using the
45
+ app on a given device. The SDK associates this user with outgoing
46
+ requests and {+backend-short+} evaluates data access permissions and runs
47
+ functions in this user's context. See :ref:`active user <active-user>` for
48
+ more information.
49
+
50
+ - **Inactive**: all authenticated users that are not the current
51
+ active user. You can :ref:`switch the active user <dotnet-switch-user>` to a
52
+ currently inactive user at any time.
53
+
54
+ - **Logged Out:** any user that authenticated on the device but
55
+ has since logged out or had their session revoked.
56
+
57
+ The following diagram shows how users within a {+service-short+} client app
58
+ transition between states when certain events occur:
59
+
60
+ .. figure:: /images/multi-user.png
61
+ :alt: A diagram the outlines the different states a user can be in: logged out, logged in and active, & logged in and inactive.
62
+
63
+
15
64
.. _node-add-a-new-user-to-the-device:
16
65
17
66
Add a New User to the Device
0 commit comments