[GODRIVER-868] Authentication failure when specifying database in connection string Created: 09/Mar/19  Updated: 04/Mar/20  Resolved: 04/Mar/20

Status: Closed
Project: Go Driver
Component/s: Authentication
Affects Version/s: 1.0.0-rc2
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: Tom Mettam Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates GODRIVER-1021 Specify behavior where connection str... Closed

 Description   

I have a MongoDB v3.6.9 cluster. Because the server is only available on private interfaces, access control is not used.

When I attempt to connect to the cluster via:

mongodb://192.168.0.1:27017,192.168.0.2:27017/mydatabase?replicaSet=rs0

This error occurs:

auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

However, when I don't specify the database:

mongodb://192.168.0.1:27017,192.168.0.2:27017/?replicaSet=rs0

The connection succeeds. The same connection string (with the database specified) works fine with other drivers.

Additional notes

Given that this particular issue has been fixed as of the 1.0.4 release, if you are still seeing the above error the most likely cause is simply that your credentials are incorrect.



 Comments   
Comment by Jeffrey Yemin [ 04/Mar/20 ]

Duplicates GODRIVER-1021.

Comment by David Golden [ 15/May/19 ]

For future reference, the driver specification for authentication has been amended to clarify that database name in URI alone should not trigger an authentication attempt.  The ticket for making that change is GODRIVER-1021.

Comment by Ian Whalen (Inactive) [ 11/Mar/19 ]

Hey caspertech, given that you're specifying an auth source in the connection string, we think it's reasonable to throw an error when you aren't specifying a user. Agreed that the error message could be more explanatory though. We'll file a ticket for that now.

As far as working fine with other drivers goes, the db name in other drivers has meant something else in the past (the default db), but the go driver doesn't have that concept.

Generated at Thu Feb 08 08:35:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.