title: how to fix: 'MongoError: authentication fail' @MongoDB Atlas
body: <p>I am connecting to MongoDB Atlas and getting authentication fail error.</p>
  
  <p>that is my connection string:</p>
  
  <pre><code>mongodb://user:&lt;password&gt;@mongo-cluster-shard-00-00-ixqtu.mongodb.net:27017,mongo-cluster-shard-00-01-ixqtu.mongodb.net:27017,mongo-cluster-shard-00-02-ixqtu.mongodb.net:27017/test?ssl=true&amp;replicaSet=mongo-cluster-shard-0&amp;authSource=admin&amp;retryWrites=true
  </code></pre>
  
  <p>That is what I get:</p>
  
  <pre><code>------------------------------------------------
  
      Mongoose connection "error" event fired with:
  
      { MongoError: authentication fail
          at Function.MongoError.create (/mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:31:11)
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/replset.js:1245:38
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:760:7
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:736:20
          at finish (/mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:168:16)
          at handleEnd (/mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:178:7)
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:269:11
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:469:18
          at process._tickCallback (internal/process/next_tick.js:61:11)
        name: 'MongoError',
        message: 'authentication fail',
        errors:
         [ { name: 'mongo-cluster-shard-00-01-ixqtu.mongodb.net:27017',
             err: [Error] },
           { name: 'mongo-cluster-shard-00-00-ixqtu.mongodb.net:27017',
             err: [Error] } ] }
      Error: KeystoneJS (Keystone Demo) failed to start - Check that you are running `mongod` in a separate process.
          at NativeConnection.&lt;anonymous&gt; (/mnt/c/WEB/keystone-md2/node_modules/keystone/lib/core/openDatabaseConnection.js:62:10)
          at NativeConnection.emit (events.js:189:13)
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/lib/connection.js:824:17
          at connectCallback (/mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:527:5)
          at /mnt/c/WEB/keystone-md2/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:459:13
          at process._tickCallback (internal/process/next_tick.js:61:11)
  </code></pre>