Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRAM-SHA-1 auth method
var username = "user";
var password = "password";
MongoInternalIdentity internalIdentity = new("auth_db_name", username);
PasswordEvidence passwordEvidence = new(password);
MongoCredential mongoCredential = new("SCRAM-SHA-1", internalIdentity, passwordEvidence);
await DB.InitAsync("DatabaseName", new MongoClientSettings
{
Server = new MongoServerAddress("localhost", 27017),
Credential = mongoCredential
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment