.Net core Mongodb Atlas, does not authenticate, get following error

Exception has occurred: CLR/MongoDB.Driver.MongoAuthenticationException
Exception thrown: ‘MongoDB.Driver.MongoAuthenticationException’ in System.Private.CoreLib.dll: ‘Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.’
Inner exceptions found, see $exception in variables window for more details.
Innermost exception MongoDB.Driver.MongoCommandException : Command saslStart failed: bad auth : Authentication failed…
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage) at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol1.d__20.MoveNext()
at MongoDB.Driver.Core.Authentication.SaslAuthenticator.d__10.MoveNext()


Service

var mongoClient = new MongoClient(settings.Value.ConnectionString);
var database = mongoClient.GetDatabase(settings.Value.DatabaseName);
_collection = database.GetCollection(settings.Value.CollectionName);

Program.ce

builder.Services.Configure(
builder.Configuration.GetSection(“MongoDBSettings”));

That exception typically means that the username and/or password is incorrect. Most often it is due to special characters in your password that require percent encoding. See Connection Strings in our documentation, especially the info box on percent encoding.

Hope that helps.