# Advice on switching the user between multiple Sendbird apps

**URL:** <https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893>\
**Category:** Sendbird Chat UIKit\
**Tags:** uikit, question\
**Created:** [July 19, 2023, 8:02pm UTC](https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893 "2023-07-19T20:02:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Winters](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ben_winters/32/4080_2.png) [@Ben\_Winters](https://community.sendbird.com/u/Ben_Winters)\
**Post date:** [July 19, 2023, 8:02pm UTC](https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893/1 "2023-07-19T20:02:35Z")

</div>

**What is the advice on managing the Sendbird connection when a user switches between different user IDs?**

We have a React Native app accompanying a SaaS web app that we sell to small businesses. We create a separate Sendbird app for each of these customer businesses to keep chats limited to the employees of that business. However, the end user has a single email-based login for our system and we allow them to potentially switch between multiple businesses while using our app (similar to belonging to multiple orgs in Slack) and so I need to switch that user between multiple Sendbird apps.

This seems straightforward enough, just need to call `connect(sendbirdUserId, { accessToken: currentOrgChatSessionToken })` with the relevant variables for that Sendbird app/business. I’m just looking for some confirmation on whether there is any cleanup needed when calling `connect()` again to switch user ids. Do I need to call `disconnect()` in between? Are there any other considerations for managing a multi-tenant environment?

---

<div class="post-metadata">

**Author:** ![Chinmaya\_Gupta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/chinmaya_gupta/32/1021_2.png) [@Chinmaya\_Gupta](https://community.sendbird.com/u/Chinmaya_Gupta)\
**Post date:** [July 20, 2023, 10:20am UTC](https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893/3 "2023-07-20T10:20:11Z")

</div>

Hello @Ben_Winters

Welcome to the Sendbird Community!

In a multi-tenant environment where users switch between different user IDs, it is recommended to call the `disconnect()` method before calling the `connect()` method with the new user ID. This ensures that the previous connection is properly closed before establishing a new connection.

Additionally, you should also consider managing the access tokens or session tokens for each user and their corresponding Sendbird app. When switching between user IDs, you should provide the relevant access token or session token for the corresponding Sendbird app in the `connect()` method.

It is also important to note that each Sendbird app has its own concurrent connection limit. Therefore, you should ensure that the number of connections from a single user ID across all Sendbird apps does not exceed the limit.

Overall, the recommended approach for managing the Sendbird connection when switching between different user IDs in a multi-tenant environment is to disconnect the current user, provide the relevant access token or session token for the new user, and then connect to the Sendbird server with the new user ID.

Let me know if this helps in clarifying a few things here.

---

<div class="post-metadata">

**Author:** ![Ben\_Winters](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ben_winters/32/4080_2.png) [@Ben\_Winters](https://community.sendbird.com/u/Ben_Winters)\
**Post date:** [July 20, 2023, 2:19pm UTC](https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893/4 "2023-07-20T14:19:38Z")

</div>

Thank you very much Chinmaya. That part about needing to call `disconnect()` when switching apps was the information I was looking for.
