Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4154

MongoSecurityException: Exception authenticating MongoCredential

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Authentication
    • Environment:
      The environment is ppc64le/UBI 8.3 (RHEL 8.3 based docker container environment).
      MongoDB server version: 4.4.4
      Mongo driver version: 3.12.8

      Issue

      Facing issues authenticating. The exception is:

      com.mongodb.MongoSecurityException: 
       Exception authenticating MongoCredential{
        mechanism=SCRAM-SHA-1,
        userName='test', 
        source='dbName', 
        password=, 
        mechanismProperties=}
      Caused by: com.mongodb.MongoCommandException: 
       Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:33132. 
      The full response is 
      {
        "ok": 0.0, 
        "errmsg": "Authentication failed.",
        "code": 18, 
        "codeName": "AuthenticationFailed"
      }
      

      The connection string is of the form: mongodb://<user>:<password>@host:port/dbName

      Likely causes

      • The user name and/or password is incorrect.
      • The dbName in the connection string is not the database in which the user is defined. Try removing it and use a connection string like: mongodb://<user>:<password>@host:port

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            maniraj.deivendran@ibm.com Maniraj Deivendran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: