Skip to content

MQTT Authentication Not Working with ChirpStack and Mosquitto #128

@dhanush-ninja

Description

@dhanush-ninja

Description:
I have configured Mosquitto with a username and password and updated both chirpstack.toml and chirpstack-gateway-bridge.toml accordingly, but the Gateway Bridge and ChirpStack fail to connect to the MQTT broker with NotAuthorized errors.


Configuration:

Mosquitto (mosquitto.conf):

listener 1883
allow_anonymous false
password_file /mosquitto/config/passwd

ChirpStack (chirpstack.toml):

[integration]
enabled=["mqtt"]

[integration.mqtt]
server="tcp://$MQTT_BROKER_HOST:1883/"
username="admin"
password="password@098"
json=true

ChirpStack Gateway Bridge (chirpstack-gateway-bridge.toml):

[integration.mqtt.auth.generic]
servers=["tcp://mosquitto:1883"]
username="admin"
password="password@098"

Observed behavior:

mosquitto-1                               | 1766123347: Client f578b34a766c0cd4 disconnected, not authorised.
chirpstack-1                              | 2025-12-19T05:49:07.926907Z ERROR chirpstack::gateway::backend::mqtt: MQTT error error=Connection refused, return code: `NotAuthorized`
chirpstack-gateway-bridge-basicstation-1  | time="2025-12-19T05:49:08.415761364Z" level=warning msg="[client]   status is already disconnected" module=mqtt
chirpstack-gateway-bridge-basicstation-1  | time="2025-12-19T05:49:08.418923358Z" level=error msg="[client]   Connecting to tcp://mosquitto:1883 CONNACK was not CONN_ACCEPTED, but rather Connection Refused: Not Authorised" module=mqtt
chirpstack-gateway-bridge-basicstation-1  | time="2025-12-19T05:49:08.418970406Z" level=error msg="[client]   Failed to connect to a broker" module=mqtt
chirpstack-gateway-bridge-basicstation-1  | time="2025-12-19T05:49:08.419641104Z" level=error msg="integration/mqtt: connection error" error="not Authorized"

Expected behavior:
ChirpStack and the Gateway Bridge should successfully connect to Mosquitto using the configured username and password.


Additional context / Questions:
Are there additional configuration changes needed in the Gateway Bridge TOML to support authenticated MQTT?


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions