How to detect which user is connected to Node-RED

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!


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

I want them to see only some parts of the dashboard by using the ui_control node

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.

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

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.

1 Like

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!

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

Thank you anyways Nathanli!

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