2 months ago
Description: Lightweight MQTT message broker.
Category: Queues
2 Replies
23 days ago
getting error Establishing a connection to the MQTT broker failed due to authorization. username and password has been checked correct.
m-fa1zal
getting error Establishing a connection to the MQTT broker failed due to authorization. username and password has been checked correct.
23 days ago
If you've already checked your username and password, the problem may be with the connection to the broker.
First, make sure you're trying to connect with the correct TCP address and port. These values are available in the MOSQUITTO_HOST and MOSQUITTO_PORT environment variables, respectively.
I've attached screenshots to this answer to show you where to find these values. There's also a screenshot with an example of publishing to this broker using Python (paho-mqtt).
This is just a simple demonstration, DO NOT HARD CODE YOUR SECRETS, a proper implementation requires Environment variables. Your production code must look like this:
```
[...]
from os import getenv
MOSQUITTO_HOST = getenv("MOSQUITTO_HOST")
MOSQUITTO_PORT = getenv("MOSQUITTO_PORT")
[...]
```
You can see an example of how to subscribe to a topic in the repository's Wiki on GitHub
Attachments