Basic auth for dashboard 2 It stops working

I'm using basic auth for dashboard 2 (@aikitori/node-red-dashboard-2-basic-auth)

but when I restart the server it stops working.

in the console it says:
node-red-dashboard-2-basic-auth: Dashboard interacted with by user1

but in the debug it does not show the user.
If I remove and reinstall node, it works again.

What could it be?

I suspect this may be a difference between the maintenance of the server/client sessions. When you restart your server, the authentication session should be lost, so I would expect the undefined.

As for the log you're seeing, I can't explain that off the top of my head. I'd expect you to be prompted again for authentication

1 Like

What do you do when you restart the server ?

Restart the System(Webserver/Node-red): sudo systemctl reboot
Restart the webserver: sudo systemctl restart nginx.service
Restart node-red: sudo systemctl restart nodered.service

1 Like

It asks me again to enter username and password but it no longer shows it in the debug

sudo reboot

(DebĂ­an 12)

So, to sanity check please, the steps you have taken:

  1. Navigate to Dashboard
  2. See prompt for authentication
  3. Authenticate & redirect to Dashboard
  4. See the output in Node-RED with the correct user assigned
  5. Restart the Node-RED Server
  6. Navigate to Dashboard
  7. See prompt for authentication
  8. Successfully login and redirect to Dashboard
  9. See the output in Node-RED, but without any associated user object
1 Like

Thank you for you reply and help.
That's right, I've done the steps again and the same thing happens.
Just to say that my address is to the editor, I have to adjust my nginx to redirect to the dashboard, but I still can't do it. If I enter directly to the dashboard 192.168.130.12:1880/dashboard/page1 it doesn't ask me for authentication and the console says:

node-red-dashboard-2-basic-auth: Session is not authenticated by Basic Auth; no user detected.

my config nginx

server {
        listen 80;
        listen [::]:80;
        server_name 192.168.130.12;

        location / {
                auth_basic "Dashboard";
                auth_basic_user_file /etc/nginx/htpasswd;
                proxy_set_header X-Forwarded-User $remote_user;
                proxy_pass http://192.168.130.12:1880;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                # try_files $uri $uri/ =404;
        }

debug before restart:

debug after restart:

After further testing and checking, it seems that there was some conflict with flowfuse/node-red-dashboard-2-user-addon. I had both installed, uninstalled it and tested again and now it works after rebooting.

Thank You..!!

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