Cannot connect to the database using SHA1 authrozation

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.1.1, 2.0.0-alpha.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Consider following code

      use mongodb::{{color:#000000}Client, options::ClientOptions{color}};
      use
      mongodb::options::{{color:#000000}Credential, AuthMechanism{color}};

      #[tokio::main]
      async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let mut client_options = ClientOptions::parse("mongodb://5.55.55.55:27017").await?;
      client_options.credential = Some(Credential::builder().username("docDev".to_string()).password("pass".to_string()).mechanism(AuthMechanism::ScramSha1).build());
      let client = Client::with_options(client_options)?;
      let db = client.database("documentsDev1");
      let collection = db.collection("Orders");
      println!("{:?}", collection.find_one(None, None).await?);
      Ok(())
      }

      Which produces following results:

      Error: Error { kind: AuthenticationError

      { message: "SCRAM failure: Authentication failed." }

      , labels: [] }
      error: process didn't exit successfully: `target\debug\untitled13.exe` (exit code: 1)

      But I'm able to login from the same machine with the same credentials via C# driver and/or Robo3T

            Assignee:
            Unassigned
            Reporter:
            Alex Zhuk
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: