-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Docs
-
Fully Compatible
From this page: https://docs.mongodb.com/mongoid/current/tutorials/mongoid-configuration/
- The database or source to authenticate the user against. (default: admin)
auth_source: admin
However, the default is not actually "admin". I had to add this line explicitly to my config in order to be able to connect, and I confirmed that removing it reintroduced the issue.
With this line, I get the following error. You can see the auth source is set to the DB-level, not admin level.
W, 2020-10-13T06:48:01.188705 #328 WARN – : MONGODB | Failed to authenticate to xxx-staging-shard-00-00.xxxxx.mongodb.net:27017: Mongo::Auth::Unauthorized: User xxx-staging-rw (mechanism: scram) is not authorized to access xxx_staging001 (auth source: xxx_staging001, used mechanism: SCRAM-SHA-1, used server: xxx-staging-shard-00-00.xxxxx.mongodb.net:27017 (PRIMARY)): Authentication failed. (18: AuthenticationFailed)
Please check and either fix code or documentation.