Details
-
Question
-
Resolution: Done
-
Unknown
-
None
-
None
-
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
Description
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