0
votes

I have an MQTT broker where devices are connecting to it and publishing data to the broker and I have a nodejs program that helps clients, subscribe to the topic, and receive the data they are publishing through their device.

Now my use case is to provide each client with a unique token which they have to send while connecting the MQTT broker in order to start publishing the data. And I want to validate that client token using an API and then establish a connection between the client and MQTT Broker.

I have searched for my use case but I have not found any help.

1

1 Answers

1
votes

Mosquitto has an authorisation plugin API that will let you build your authentication scheme.

The doc for the API is here

You can also search GitHub for existing auth plugins e.g. https://github.com/jpmens/mosquitto-auth-plug (this plugin is no longer being developed but there are active forks)