node-wot icon indicating copy to clipboard operation
node-wot copied to clipboard

MqttBrokerServer ignores username

Open ctron opened this issue 3 years ago • 1 comments

Trying to use MqttBrokerServer with a username/password combination fails with "bad username or password", while the credentials are ok.

Enabling the log shows why:

 node-wot:binding-mqtt:mqtt-broker-server:debug MqttBrokerServer trying to connect to secured broker at ssl://mqtt.sandbox.drogue.cloud with client ID wot11668767174292 +0ms
  mqttjs connecting to an MQTT broker... +0ms
  mqttjs:client MqttClient :: options.protocol ssl +0ms
  mqttjs:client MqttClient :: options.protocolVersion 5 +0ms
  mqttjs:client MqttClient :: options.username undefined +0ms
  mqttjs:client MqttClient :: options.keepalive 60 +0ms
  mqttjs:client MqttClient :: options.reconnectPeriod 1000 +1ms
  mqttjs:client MqttClient :: options.rejectUnauthorized undefined +0ms
  mqttjs:client MqttClient :: options.topicAliasMaximum undefined +0ms
  mqttjs:client MqttClient :: clientId wot11668767174292 +0ms
  mqttjs:client MqttClient :: setting up stream +0ms

I says connect to secured broker (which indicates a password is present in the configuration, but then has options.username undefined.

ctron avatar Nov 18 '22 10:11 ctron

Taking a look at the mqtt dependency, the properties seem to be:

username: the username required by your broker, if any password: the password required by your broker, if any

Instead of user and psw.

ctron avatar Nov 18 '22 10:11 ctron