Use JWT token based authentication with HiveMQ Edge

Hi,
I am using HiveMQ-Edge Broker.

I have a react-js front end app, currently I am using self-signed certificate to enable secured websocket connection to connect to hivemq edge broker.
I want to use JWT token to connect with hivemq-edge broker. Could you please guide me to correct configurations?

another question I have is- how to add username and password to the config.xml file of hivemq-edge to enable basic authentication. so that whenever react.js app tries to connect with the broker it should provide username and password.

Hi @Payal

Thank you for reaching out!

HiveMQ Edge does not support JWT-based authentication at this time.

If you need more details or have any other questions, feel free to ask!

Best regards,
Dasha from The HiveMQ Team

Do you have any react.js support for certificate authentication? we are trying it but we cannot add certificate in react.js code it seems.

Hi @Payal,

HiveMQ does not provide an official MQTT client for React.js. However, we do offer the following client libraries:

For React.js, you may consider using a third-party MQTT JavaScript client. You can find an example in your HiveMQ Cloud Console https://console.hivemq.cloud in the Getting Started top-bar right menu:

I hope this helps! Let me know if you have any further questions.

Best regards,
Dasha
HiveMQ Support Team

okay I will check this out. meanwhile can you tell me how to add username and password in the hivemq broker config.xml?

currently we are setting RBAC extension to allow and creating new file with following credentials:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> admin

pass1

admin





admin

#




Is there any basic authentication for hivemq broker? username and password?

Hi @Payal

To enable Role-Based Access Control (RBAC) in HiveMQ Edge, you need to install a security extension. HiveMQ provides an open-source security extension called the File RBAC Extension, which you can find here: File RBAC Extension Documentation.

Below are the steps to install the extension:

wget https://github.com/hivemq/hivemq-file-rbac-extension/releases/download/4.6.3/hivemq-file-rbac-extension-4.6.3.zip

unzip hivemq-file-rbac-extension-4.6.3.zip -d $HIVEMQ_HOME/extensions

touch $HIVEMQ_HOME/extensions/hivemq-allow-all-extension/DISABLED

This will install the File RBAC Extension and disable the “Allow All” extension to ensure that RBAC rules are enforced in HiveMQ Edge.

Check your working using MQTT-CLI client. (Documentation and Installation Instructions here). In one terminal window, subscribe the client:

mqtt subscribe --topic '#' --qos 1 --identifier SUBSCRIBER --user admin-user --password admin-password --debug --verbose

In another terminal window, publish a message from the client:

mqtt publish --topic 'test' --qos 1 --identifier PUBLISHER --user admin-user --password admin-password --debug --verbose

Please let me know if you need any further assistance!

Best regards,
Dasha from The HiveMQ Team

Hi @Daria_H, Apologies for late response, I was under impression that RBAC is for setting username and password for UI which is running on port 8080.
but this cleared the misunderstanding.
I will try to set the username and password using given steps and check If I can access the broker.