-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.11.2
-
Component/s: Connectivity
-
None
-
Fully Compatible
Consider the following code snippet:
var uri = "mongodb+srv://AWS_KEY:AWS_PRIVATE_KEY@cluster441.ebdql.mongodb.net/<dbname>?authMechanism=MONGODB-AWS&authSource=%24external&retryWrites=true&w=majority"; var mongoURL = new MongoUrl(uri); var client = new MongoClient(mongoURL); Console.WriteLine("Finished!");
Construction of the MongoClient instance fails with the following stack trace:
Unhandled Exception: System.ArgumentException: A MONGODB-AWS source must be $external. Parameter name: source at MongoDB.Driver.MongoCredential.EnsureNullOrExternalSource(String mechanism, String source) at MongoDB.Driver.MongoCredential.FromComponents(String mechanism, String source, String databaseName, String username, MongoIdentityEvidence evidence) at MongoDB.Driver.MongoClientSettings.FromUrl(MongoUrl url) at MongoDB.Driver.MongoClient..ctor(MongoUrl url) at tour.Program.Main(String[] args) in /shared/csharp/Program.cs:line 14
If we change authSource=%24external to authSource=$external, the code works as expected. If we change the scheme from mongodb+srv:// to mongodb:// (and switched to the correct hostnames), it also works as expected.
- related to
-
CSHARP-3239 Cannot authenticate with an AWS session token
- Closed