Mongo Atlas: Connection authentication failed with custom databases
You authenticate with the admin database. From there you can switch the database.
When connecting using Mongo drivers, your connection string needs add the auth source:
/any_database?authSource=admin&replicaSet=xyz
Adding to Nath's answer, use "--authenticationDatabase admin" if your connecting via the mongo shell and use "authSource=admin" for drivers.
Tested with [MongoDB shell version: 3.2.8]
"authSource=admin"
Is a requirement for All Atlas connections.