(adminAuth) unable to login node-red

my problem is unable to login in node-red.the node-red is normal running if remove the adminAuth in setting.js files.


But if I set adminAuth in setting.js file with username/password:admin/admin

then I restart the node-red. the node-red is normal starting.

But i can't login in the node-red editor

Have you purposely not removed the // from the start of the sessionexpiry line?

That's an optional field so won't have an bearing here.

if i don't remove the "//", the node-red login web will be missing, and can editor the flow directly. The Node-red flows work normally.


Now i want to use adminAuth. i have already test adminAuth settting successfully in CPU:ARMv7 Processor rev 5 (v7l) platform, But i test adminAuth setting failed in CPU:MIPS 1004Kc V2.15.

I don't know how to find the Error for this problem?

could you give me some advices for how to find the error and solve it.

could you give me some any reply?

Do you have any good idea for this problem? thanks very much!

It is hard to tell from the screenshots exactly what error you hit.

Is it:

  1. you cannot enter a password in the dialog (known issue: https://github.com/node-red/node-red/issues/1982)
  2. you can enter a password and click login but the request hangs (you last screenshot looks like that)
  3. you can enter a password and click login, but it returns a 'login failed' type message?

Have you looked at the JavaScript console for any errors?

i can enter a password and click login but after i click login the web request hangs continuous about 40 seconds,then it returns a 'login failed' type message. i have also use a error username or error password to test , there are same phenomenon.About the JavaScript console without any errors printing.
This is the Caught file.

Can you edit your settings.js file and set the logging.audit value to true and the logging.level to "trace". Then restart Node-RED and try again. Then see what the Node-RED log shows.

It is odd for it to take 40 seconds to respond - I'm not sure what could cause that. What type of machine is this running on?

1 Like

I think that the username and password did not work .

What hardware is this running on? The uname command says Linux router - so is this a low powered, low memory router type device? That could explain why it takes so long to respond - the bcrypt password hashing can be quite slow on slow devices. But it doesn't explain why the login fails.

When node-red is installed, it tries to install the bcrypt module to handle the password hashing. This is a binary module that doesn't always successfully install. As a fall back, we also install bcryptjs - a pure javascript implementation that will install cleanly, but is much slower than the binary module.

Can you try reinstalling the bcrypt module; in the directory /mnt/sd/node-js-app/node-red-0.19.5/ run npm install bcrypt

Node-red run in embedded Router device(Linux operating system), i know the bcrypt module that doesn't always successfully install.i have checkout that bcrypt is install Success.

Not sure if it still relevant,
but the following method worked for me (version 1.0.3):

  1. Run npm install -g node-red-admin or use this tutorial
  2. Generate the password hash by running node-red-admin hash-pw
  3. Type your preferred password (case-sensitive) and write it down.
  4. Edit settings.js file, go to adminAuth. section (line 123 more or less) - change the username property to the one you want (again, case sensitive) and the password property to the generated password from step 2.
  5. Save everything, restart node-red.
  6. Login with username and the password from step 3.

Hope that helps anyone.

2 Likes
Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:329:19)
    at completeConnection (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:103:28)
    at WebSocket.<anonymous> (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:148:21)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:74:10)
Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:329:19)
    at completeConnection (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:103:28)
    at WebSocket.<anonymous> (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:148:21)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:74:10)
Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:329:19)
    at completeConnection (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:103:28)
    at WebSocket.<anonymous> (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:148:21)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:74:10)
Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:329:19)
    at completeConnection (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:103:28)
    at WebSocket.<anonymous> (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:148:21)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:74:10)
Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:329:19)
    at completeConnection (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:103:28)
    at WebSocket.<anonymous> (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/@node-red/editor-api/lib/editor/comms.js:148:21)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/home/abhishek/.nvm/versions/node/v10.15.3/lib/node_modules/node-red/node_modules/ws/lib/receiver.js:74:10)

This issue is appearing when uncommenting the

 adminAuth: {
       type: "credentials",
       users: [{
           username: "admin",
           password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
           permissions: "*"
       }]
    },
ui: { path: "ui" },

Log In Is Not Working

Hi @abhishekjaiswalraw

as you've posted to this topic, have you followed the advice that was shared in order to try to get more logging/trace information?

You don't mention what version of Node-RED/Node.js you are using. That would be helpful to know.


"Still not working"

// Configure the logging output
    logging: {
        // Only console logging is currently supported
        console: {
            // Level of logging to be recorded. Options are:
            // fatal - only those errors which make the application unusable should be recorded
            // error - record errors which are deemed fatal for a particular request + fatal errors
            // warn - record problems which are non fatal + errors + fatal errors
            // info - record information about the general running of the application + warn + error + fatal errors
            // debug - record information which is more verbose than info + info + warn + error + fatal errors
            // trace - record very detailed logging + debug + info + warn + error + fatal errors
            // off - turn off all logging (doesn't affect metrics or audit)
            level: "trace",
            // Whether or not to include metric events in the log output
            metrics: false,
            // Whether or not to include audit events in the log output
            audit: true
        }
    },

I'm using nvm