1
votes

We are have problems connecting our Spring Boot server to a MongoLab's 3.0.7 version database. The code work fine using a local Mongo 3.0 instance but fails when connecting to the MongoLab's servers.

Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'auth failed' on server myserver.com:99999. The full response is { "ok" : 0.0, "errmsg" : "auth failed", "code" : 18 }

We are using Spring Boot 1.2.6.RELEASE and the MongoDB driver 3.0.4 We have also tried with driver 2.15.5

Neither was able to connect.

Any help is appreciated.

1
Can you try adding "&authMechanism=SCRAM-SHA-1" to the end of the connection string / uri ? - pneumee
That didn't work: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='test', source='test', password=<hidden>, mechanismProperties={}} Command failed with error 18: 'Authentication failed.' on server myserver:99999. The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." - Benj F
My bad - this did solve the problem. Thank you. I will add it as the answer. - Benj F

1 Answers

2
votes

As suggested by pneumee in the comment above the solution was adding "&authMechanism=SCRAM-SHA-1" to the end of the connection string / uri.