RabbitMQ ACCESS_REFUSED: login was refused using authentication mechanism PLAIN
Codemia Knowledge Hub ·
"ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN" means the server rejected a username and password login. It is common with AMQP (Advanced Message Queuing Protocol) brokers such as RabbitMQ, where PLAIN is the simple username and password authentication mechanism. The usual cause is wrong credentials, but a disabled mechanism, account state, configuration or a TLS requirement can also trigger it.
How PLAIN authentication works
PLAIN sends the username and password over the network as plain text, optionally encrypted by the underlying protocol (such as TLS/SSL). The client sends a message containing:
- A protocol header, indicating this is a PLAIN login attempt.
- The username.
- The password.
These are usually packed into a single message with fields separated by a zero byte (\0), for example:
This means an empty authorization identity ("use the authentication identity"), then the username, then the password.
Why the broker refuses the login
- Incorrect credentials: the most common cause. The username or password is wrong.
- PLAIN disabled: some servers turn PLAIN off for security, because it is weaker than alternatives such as SCRAM or certificate-based methods.
- Account status: the account is disabled, expired, or locked after repeated failed logins.
- Configuration issues: access control or user privileges are set up incorrectly on the server.
- TLS/SSL required: the server requires an encrypted connection and refuses logins over an insecure one.
Troubleshooting steps
- Verify credentials: confirm the username and password are the ones the server expects.
- Check the server configuration: in the configuration files or admin panel, make sure PLAIN authentication is enabled and configured correctly.
- Check SSL/TLS: if the server requires it, make sure your connection is encrypted.
- Review the account: confirm the user is active and not locked or disabled.
- Read the logs: the server's error log often says why access was refused.
RabbitMQ configuration example
A RabbitMQ configuration file can include settings like these for authentication backends and SSL/TLS:
Here ssl_listeners opens a TLS port and ssl_options sets its certificates, so clients connecting on 5671 are encrypted.
Keep in mind that PLAIN transmits the password in clear text, so it can be intercepted unless the connection is encrypted.
Related reading
- Access to Modified Closure 2
- AccessDenied Not authorized to perform stsAssumeRoleWithWebIdentity
- AccessDeniedException User is not authorized to perform lambdaInvokeFunction
- Accessing Kafka broker from outside my LAN
- Access refused for user rabbitmq & celery
- Access to foreach variable in closure warning
- Accessing RDS from within a Docker container not getting through security group?
- Activity has leaked window that was originally added
System design interview problems on this topic
- Design a Secure Identity Management System: solution and walkthrough
- Design an API Rate Limiter: solution and walkthrough
- Design a Network Security Monitoring Tool: solution and walkthrough
- Design a CAPTCHA System: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.