Connection issues to MQTT broker from device

Hello all,

Having some connection issues to MQTT broker from our ESP32 based devices in the field. We are currently looking into our provisioning process where I see that some devices are being assigned 2 keys. This is certainly an issue with our programming and will get solved but what I am wondering is if there is a way to query MQTT log files to see if a device connection is being rejected for trying to authenticate with an incorrect key value?

Hi @Dave_Blaylock !

If a device attempts to establish connection with an invalid access key, the error message “Application key/secret invalid” will appear in real-time in the device communication log or application log. Note that this message will not appear in the historical device connection log.

If a device is connected and the access key is revoked or changed, the connection log message should be “Device no longer allowed”. This will appear in both the live log and the historical log.

Otherwise, do you have any logs from an affected ESP32 device that might help point us in the right direction?

Hi Sebastian, thanks for you response. I don’t have a device log for this specific device unfortunately as I turned off one of the access keys associated with the device and it connected.

We are working through our multi access key assignment to a single device issue but I was working with a device today that had two access keys assigned to it. the keys have a creation time of less than one second apart. the device knows only one key and it is the latest key created. both keys are set to active in Losant. The device can connect to my router but cannot connect to Losant’s MQTT broker. The device has a MQTT auto connect retry function so it is constantly trying to connect. I made inactive the newest key and nothing happened so I reactivated it. I then waited a couple of minutes and made inactive the oldest of the two keys and to my surprise the device connected. My question, If a device has more than one active access key associated with it in Losant and the device tries to authenticate through MQTT, will the MQTT broker authenticate the device and allow communication?

Tomorrow I will make both keys active again to see what happens to the connection and to get the connection data log.

Yes, if a device has more than one valid access key, it will authenticate. Let us know how your testing goes and if you have any further questions.