MQTT Broker Authentication
Most production MQTT brokers require authentication to prevent unauthorized access.Configuring Credentials
Enter Credentials
Fill in the authentication fields:
- Username: Your MQTT broker username
- Password: Your MQTT broker password
These fields are marked as “Optional” because some brokers (like public test brokers) don’t require authentication.
Password Visibility
MQTT Explorer includes a password visibility toggle to help you verify your credentials:- Click the eye icon to show the password
- Click again to hide it
- Passwords are hidden by default for security
Connection Parameters
The username for authenticating with the MQTT broker.Use cases:
- Basic authentication with username/password
- Access control and user identification
- Audit logging and connection tracking
admin- Administrator accountdevice-001- Device-specific credentialsreadonly-user- Limited permissions account
The password for authenticating with the MQTT broker.Security considerations:
Passwords are stored locally in your connection profiles. In browser mode, they’re stored in browser localStorage. In desktop mode, they’re stored in the application’s configuration directory.
- Use strong, unique passwords for each broker
- Rotate passwords regularly
- Never share credentials or commit them to version control
- Use TLS/SSL to encrypt password transmission
Auto-Connect with Credentials
When running MQTT Explorer in server/browser mode, you can configure broker credentials via environment variables for automatic connection:Server Authentication (Browser Mode)
When running MQTT Explorer in browser mode, the web interface itself can be protected with authentication.Authentication Manager
MQTT Explorer uses bcrypt password hashing and rate limiting for secure authentication:- bcrypt hashing: Passwords hashed with 10 rounds (industry standard)
- Timing-safe comparison: Username comparison uses
crypto.timingSafeEqual()to prevent timing attacks - Rate limiting: Maximum 5 failed attempts per IP per 15 minutes
- Automatic reset: Rate limit counters reset after 15 minutes
Configuration Options
Username for accessing the MQTT Explorer web interface.Default behavior: If not set, a random username is generated (e.g.,
user-a1b2c3d4)Password for accessing the MQTT Explorer web interface.Default behavior: If not set, a random UUID password is generated and displayed in the console on first startup.
Disable authentication entirely for the web interface.When enabled, you’ll see this warning on startup:
First-Time Setup
When you run MQTT Explorer in browser mode without configured credentials:Save Credentials
Copy the username and password immediately. They’re saved to a credentials file but the password is hashed, so you can’t retrieve the plain text later.
Credential Priority
MQTT Explorer checks for credentials in this order:- Environment variables (highest priority)
MQTT_EXPLORER_USERNAMEMQTT_EXPLORER_PASSWORD
- Credentials file (persisted from first run)
~/.mqtt-explorer-credentials.json
- Auto-generation (lowest priority)
- Generates new random credentials if none exist
Environment variables always take precedence. Set them in production to override any persisted credentials.
Production Deployment
Recommended Setup
For secure production deployments, follow these steps:Docker Deployment
Access Control Lists (ACL)
MQTT brokers often use ACLs to control which topics users can access. MQTT Explorer respects these restrictions.Common ACL Patterns
Read-Only Access
Read-Only Access
User can subscribe to topics but cannot publish:MQTT Explorer behavior:
- ✅ Can view all topics
- ✅ Can receive messages
- ❌ Cannot publish messages (publish will fail)
Topic-Specific Access
Topic-Specific Access
User can only access specific topic patterns:MQTT Explorer behavior:
- ✅ Can view
devices/device-001/*topics - ✅ Can publish to
devices/device-001/* - ✅ Can view
system/status - ❌ Cannot view or publish to other topics
Administrative Access
Administrative Access
User has full access to all topics:MQTT Explorer behavior:
- ✅ Full access to all topics
- ✅ Can view broker statistics ($SYS)
- ✅ Can publish and subscribe anywhere
Testing ACL Permissions
To verify your user’s permissions:- Connect with your credentials
- Try subscribing to various topics
- Attempt to publish messages
- Check broker logs for ACL denials
MQTT Explorer will show topics you have permission to view. Denied topics won’t appear in the topic tree.
Troubleshooting
Authentication failed
Authentication failed
Symptoms: Connection refused with authentication errorCauses:
- Incorrect username or password
- User doesn’t exist on broker
- Special characters not properly escaped
- Verify credentials are correct (check for typos)
- Check broker user database:
mosquitto_passwd -U passwordfile - Test with mosquitto_sub:
mosquitto_sub -h host -u user -P pass -t # - Check broker logs for authentication failures
Rate limit exceeded (Browser Mode)
Rate limit exceeded (Browser Mode)
Symptoms: “Too many failed login attempts” messageCauses:
- 5 failed login attempts within 15 minutes
- Brute force protection triggered
- Wait 15 minutes for automatic reset
- Verify correct credentials
- Check if credentials were changed on the server
- Restart server to reset rate limits (not recommended)
Lost server credentials
Lost server credentials
Symptoms: Can’t access browser interface, don’t remember passwordSolutions:
- Check server console output from first startup (if available)
- Delete credentials file:
rm ~/.mqtt-explorer-credentials.json - Set new credentials via environment variables:
- Restart server to generate new random credentials
ACL denies access
ACL denies access
Symptoms: Topics not appearing, publish failsCauses:
- User ACL restricts topic access
- Insufficient permissions
- Check broker ACL configuration
- Verify user has required permissions:
readand/orwrite - Check broker logs for ACL denial messages
- Use an admin account for full access
- Request permission updates from broker administrator
Password contains special characters
Password contains special characters
Symptoms: Authentication works in some tools but not othersCauses:
- Special characters need proper escaping
- Different escaping rules in shells vs config files
- Quote passwords in shell:
export PASSWORD='p@$$w0rd!' - Use connection profiles instead of environment variables
- Avoid characters that need escaping:
$,!, backticks, quotes - Test with a simple password first to isolate the issue
Security Best Practices
Strong Passwords
Use passwords with at least 12 characters, including uppercase, lowercase, numbers, and special characters.
Unique Credentials
Use different credentials for each environment (dev, staging, production) and each user.
Regular Rotation
Rotate passwords every 90 days and immediately after suspected compromise.
TLS Required
Always use TLS/SSL when transmitting credentials to prevent interception.
Least Privilege
Grant users minimum required permissions using ACLs. Use read-only accounts when possible.
Monitor Access
Review broker logs regularly for failed authentication attempts and unusual activity.
Next Steps
TLS/SSL Configuration
Encrypt authentication credentials in transit with TLS/SSL certificates.
Environment Variables
Learn about all available environment variables for server configuration.
Connection Setup
Return to the connection setup guide for other configuration options.
Security Policy
Review the complete security policy and report vulnerabilities.