MongoCommandException : Command saslContinue failed: bad auth : Authentication failed

As part of Chapter 1: Getting Started - Ticket: Connecting to Atlas, I’ve added my connection string in the appsettings.json for the MongoUri value:

mongodb+srv://(username):(password)@mflix.yryjx.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

However, when running the TestReturnsOneMovie test, I receive the following error:

MongoDB.Driver.MongoAuthenticationException : Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.
----> MongoDB.Driver.MongoCommandException : Command saslContinue failed: bad auth : Authentication failed…

I’ve tried creating a brand new user and I got the same error. Any ideas why?

It says bad authentication
Are you using the correct user id/password?
Can you connect by shell using the same id/pwd that you added in your app?

Yes, I created a brand new simple username and password to test as well. Also, I can connect using the same connection string in MongoDB Compass.

Looks like it may have been a network/firewall issue. All sorted now.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.