# How to detect which user is connected to Node-RED

**URL:** <https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979>\
**Category:** General\
**Tags:** node-red-dashboard, security\
**Created:** [17 March 2022 09:11 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979 "2022-03-17T09:11:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [17 March 2022 09:11 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/1 "2022-03-17T09:11:11Z")

</div>

Hi everyone,

I am trying to do a Node-RED application authenticated with multiple users, and I want to detect which user is connected, to show different parts of the Dashboard with the ui\_node.

How can I get which user is connected every time?

The only way I know how to authenticate users is through the settings.js (adminAuth field). If there is another way to create them, so that I can detect them in my Node-RED flow, it would be welcome too.

Thank you in advance!

Q.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 March 2022 09:50 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/2 "2022-03-17T09:50:52Z")

</div>

What are you going to do if there are multiple users connected at the same time?

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [17 March 2022 10:01 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/3 "2022-03-17T10:01:00Z")

</div>

I want them to see only some parts of the dashboard by using the ui\_control node

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 March 2022 10:03 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/4 "2022-03-17T10:03:11Z")

</div>

So when you said you want to know which user is logged on, you actually want to know which user is associated with each session. I don't know if there is a way to do that.

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [17 March 2022 10:04 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/5 "2022-03-17T10:04:51Z")

</div>

Exactly. Thank you anyways! I'll keepsearching and I'll let you know whenever I find the solution for that

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 March 2022 13:02 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/6 "2022-03-17T13:02:32Z")

</div>

You should also remember that Dashboard is a single-page app.

Just because it isn't showing something doesn't mean that it isn't reachable by a knowledgeable user. I'd probably suggest having some REST API endpoints and using Fetch to get user-specific data dynamically.

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [18 March 2022 11:24 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/7 "2022-03-18T11:24:47Z")

</div>

I went to the browser, inspected the web page after login, and saw the field where my credentials were. I tried to call it but I received "Unauthorized" all the time since I understood that I had to give it an ID that I don't know where to get it from.

So I finally decided to create a ui\_form for login, hide the rest of the application with ui\_control, have a database with my users, and depending on which user accesses the dashboard, show them one part of the application or another.

Thanks everyone anyway!

---

<div class="post-metadata">

**Author:** ![Nathanli](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@Nathanli](https://discourse.nodered.org/u/Nathanli)\
**Post date:** [31 March 2022 14:23 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/8 "2022-03-31T14:23:46Z")

</div>

Hello, I'm sorry I can't help you. Because I have encountered this problem recently, but I will continue to search and inform you whenever I find a solution

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [4 April 2022 10:42 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/9 "2022-04-04T10:42:04Z")

</div>

Thank you anyways Nathanli!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 April 2022 10:42 UTC](https://discourse.nodered.org/t/how-to-detect-which-user-is-connected-to-node-red/59979/10 "2022-04-18T10:42:04Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
