Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1836

Authentication fails if authSource not specified in URI

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.11
    • Component/s: Authentication
    • Labels:
      None

      When a user has been created in the admin database, it should be possible to authenticate using a URI like: "mongodb://user:password@server". 

      According to https://docs.mongodb.com/manual/reference/connection-string/: 

      /database Optional. The name of the database to authenticate if the connection string includes authentication credentials in the form of username:password@. If /database is not specified and the connection string includes credentials, the driver will authenticate to the admin database.

      However the current version of the node driver fails with MongoError: Authentication failed with the server logs stating UserNotFound: Could not find user user@undefined

      This does with if you add **/?authSource=admin at the end of the URI. C# driver works as expected (I didn't test any others).

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            tom.hollander@mongodb.com Tom Hollander
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: