I'm encountering an authentication error when trying to connect my Flask application to a MongoDB server using Flask-PyMongo. I have verified that the credentials are correct, but I'm still facing this issue.
app.config['MONGO_URI'] = (
"mongodb://"
f"{urllib.parse.quote_plus('newAdminUser')}:{urllib.parse.quote_plus('your-password')}"
"@localhost:27017/Documents"
)
Authentication: I have verified that the credentials (newAdminUser and your-password) are correct.
MongoDB Server Status: The MongoDB server is up and running at localhost:27017.
Authentication Database: I am authenticating against the correct database named Documents.
User Roles and Privileges: The user newAdminUser has been granted appropriate roles and privileges for the specified database.
Network and Firewall: I have checked for any network or firewall issues that might prevent the connection between the Flask app and MongoDB server.
Error Message: The error message I'm receiving is:pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}