18 — AuthenticationFailed

authenticationauthorisation

Authentication credentials are invalid or the mechanism failed

What is happening?

AuthenticationFailed means the client provided credentials that MongoDB could not verify. This differs from Unauthorized (13): error 18 means the login itself failed, while error 13 means the user logged in successfully but lacks permission for a specific operation.

Common causes

  1. Incorrect password
  2. Wrong username or authentication database (authSource)
  3. SCRAM mechanism mismatch between client and server
  4. User credentials were changed but the application uses cached credentials
  5. X.509 certificate does not match the configured user
  6. LDAP authentication backend is unreachable

Diagnostic Steps