Navigation

Multi-User Applications - React Native SDK

On this page

  • Add a New User to the Device
  • List All Users on the Device
  • Remove a User from the Device
  • Change the Active User

The Realm SDK automatically adds users to a device when they log in for the first time on that device. When a user logs in, they immediately become the application's active user.

Example

In the example below, a user with the email joe@example.com logs in and becomes the active user. Later, a user with the email emma@example.com logs in and becomes the active user.

You can access a list of all user accounts on the device. This list includes all users that have logged in to the client app on a given device.

Example

In the example below, a developer prints out all the logged-in users on the device by looping through Realm.App.allUsers.

You can remove all information about a user from the device and automatically log the user out.

Example

In the example below, the current user is removed from the device using the Realm.App.removeUser() method.

You can quickly switch an app's active user to another logged-in user at any time.

Example

In the example below, the active user is initially switched to user1 using the Realm.App.switchUser() method. Later, the active user is switched to user2.

Give Feedback

On this page

  • Add a New User to the Device
  • List All Users on the Device
  • Remove a User from the Device
  • Change the Active User