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.
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.
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.
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.
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