Skip to content

Instantly share code, notes, and snippets.

@dj-nitehawk
Created March 30, 2021 15:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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