Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Has anyone successfully configured a connection to MongoDB 6 with SCRAM-SHA-256? I am able to force SHA-256 by setting the authMechanism advanced attribute, but I am getting "Not authorized to query database", even though the account works through other clients.
Hi
If you're encountering a "Not authorized to query database" error when connecting Qlik to MongoDB 6 with SCRAM-SHA-256 authentication, here are some troubleshooting steps to address the issue:
Ensure the user account you're using has the correct roles and privileges for the database you're trying to query. You can check the roles assigned to the user with the following command in MongoDB:
db.getUser("your_username")
Verify that the user has at least the read role (or higher, such as readWrite) for the target database.
MongoDB often uses the admin database for authentication. Ensure that your connection string or settings specify the correct authSource:
If the user was created in the admin database:
mongodb://username:password@host:port/database?authSource=admin
If the user was created in a specific database:
mongodb://username:password@host:port/database?authSource=database_name
Connect to MongoDB using the mongo shell to confirm that the credentials and authentication mechanism are working:
mongo --username your_username --password your_password --authenticationDatabase admin --authenticationMechanism SCRAM-SHA-256
If this fails, there may be an issue with the credentials or user setup.