Password protection is not working

Hi Team, Currently I am using Node-Red 3.1.8. I followed document how to apply password protection but still not working.

adminAuth: {
       type: "credentials",
       users: [{
           username: "admin",
           password: "$2b$08$260oPVF33WAQsV60LUlQXu6g22Ub9R35ycBdSFghPNx//hrqVgbxS",
           permissions: "*"
       }]
    },
httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},

Kindly guide me

Hi @k-usama1495

Have you restarted Node RED after applying the changes to settings.js?

1 Like

yes,

"start": "node packages/node_modules/node-red/red.js",
        "test": "grunt",
        "build": "grunt build",
        "dev": "grunt dev",
        "build-dev": "grunt build-dev",
        "docs": "grunt docs"

I have used npm run start but not showing username password

Ok, I don't often see Node RED being started like that.
can you provide the terminal output that this is producing?

Importantly, what settings file is being loaded, to ensure you have modified the correct one.

1 Like
npm run start

> node-red@3.1.8 start
> node packages/node_modules/node-red/red.js

28 May 00:24:05 - [info]

Welcome to Node-RED
===================

28 May 00:24:05 - [info] Node-RED version: v3.1.8
28 May 00:24:05 - [info] Node.js  version: v18.19.0
28 May 00:24:05 - [info] Darwin 23.1.0 arm64 LE
28 May 00:24:05 - [info] Loading palette nodes
28 May 00:24:06 - [info] Dashboard version 3.6.5 started at /ui
28 May 00:24:06 - [info] Settings file  : /Users/glosys/.node-red/settings.js
28 May 00:24:06 - [info] Context store  : 'default' [module=memory]
28 May 00:24:06 - [info] User directory : /Users/glosys/.node-red
28 May 00:24:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 May 00:24:06 - [info] Flows file     : /Users/glosys/.node-red/flows.json
28 May 00:24:06 - [info] Server now running at http://127.0.0.1:1880/
28 May 00:24:06 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

28 May 00:24:06 - [info] Starting flows
MongoNode {
  id: 'd6110c5ea6b3b2d6',
  type: 'mongodb',
  z: undefined,
  g: undefined,
  _closeCallbacks: [],
  _inputCallback: null,
  _inputCallbacks: null,
  _expectedDoneCount: 0,
  name: 'LocalHost-27017',
  wires: [],
  _wireCount: 0,
  send: [Function: NOOP_SEND],
  credentials: { user: 'admin', password: 'admin' },
  hostname: '127.0.0.1',
  port: '27017',
  db: 'fuel'
}





 {
  id: 'd6110c5ea6b3b2d6',
  type: 'mongodb',
  hostname: '127.0.0.1',
  port: '27017',
  db: 'fuel',
  name: 'LocalHost-27017',
  _users: [ '597e2d3f90b49631' ]
}
mongodb://admin:admin@127.0.0.1:27017/fuel
28 May 00:24:06 - [info] [mongodb4-client:local-db] client initialized with app name 'nodered-ko1vqcpb'
28 May 00:24:06 - [error] [mongodb4-client:e2bc7ac9aa77279e] MongoMissingCredentialsError: Username required for mechanism 'SCRAM-SHA-256'
28 May 00:24:06 - [error] [mongodb4-client:dd0b7f14421d961d] MongoMissingCredentialsError: Username required for mechanism 'SCRAM-SHA-256'
28 May 00:24:06 - [error] [mongodb out:4] missing mongodb configuration
28 May 00:24:06 - [info] Started flows
![Screenshot 2024-05-28 at 12.30.38 AM|342x500](upload://nqGX9jAx0f5s9uP4PGrvbLPcFFC.png)
![Screenshot 2024-05-28 at 12.30.50 AM|690x336](upload://5207Bjkd321FOrEx3TisVvbw10B.png)
![Screenshot 2024-05-28 at 12.31.12 AM|690x157](upload://8XegSr0Tzw4euUmQF6NrJ9jXa8C.png)

So this one :point_up: you have modified the adminAuth section?

1 Like


Ok - You shouldn't be modifying the settings file inside the app its self.

You need to modify this one : /Users/glosys/.node-red/settings.js

the loaded settings file is the one located in ~/.node-red (the users Node RED Directory)

1 Like

Thanks bro, I found - bahot bahot shukriya (Urdu)

1 Like

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