Discussion:
[mongodb-user] PyMongo Authentication
j***@blendlabs.com
2017-01-17 20:35:15 UTC
Permalink
Does anyone know how to auth with pymongo w/o username and password?
client['localhost'].authenticate('','', mechanism='MONGODB-CR')
Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line
1018, in authenticate

connect=True)

File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py",
line 444, in _cache_credentials

sock_info.authenticate(credentials)

File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 343,
in authenticate

auth.authenticate(credentials, self)

File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 464,
in authenticate

auth_func(credentials, sock_info)

File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 432,
in _authenticate_mongo_cr

key = _auth_key(nonce, username, password)

File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 266,
in _auth_key

digest = _password_digest(username, password)

File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 252,
in _password_digest

raise ValueError("password can't be empty")

ValueError: password can't be empty
client['localhost'].authenticate('',None, mechanism='MONGODB-CR')
Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line
1013, in authenticate

validated_options)

File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 77,
in _build_credentials_tuple

raise ConfigurationError("A password is required.")

pymongo.errors.ConfigurationError: A password is required.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/3cf0a5cf-8460-49b4-834a-6c52171ec5cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Andrew Erlichson' via mongodb-user
2017-01-18 15:28:27 UTC
Permalink
If you want to connect to a database with no auth enabled, you call call
MongoClient()

Instructions are here:

https://api.mongodb.com/python/current/tutorial.html

Note that you should always secure MongoDB for a production deployment,
including running it behind a firewall and turning authentication on. Here
is a full security checklist
<https://docs.mongodb.com/manual/administration/security-checklist/?_ga=1.1568820.461821616.1433863947>
.
Post by j***@blendlabs.com
Does anyone know how to auth with pymongo w/o username and password?
client['localhost'].authenticate('','', mechanism='MONGODB-CR')
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line
1018, in authenticate
connect=True)
File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py",
line 444, in _cache_credentials
sock_info.authenticate(credentials)
File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 343,
in authenticate
auth.authenticate(credentials, self)
File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 464,
in authenticate
auth_func(credentials, sock_info)
File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 432,
in _authenticate_mongo_cr
key = _auth_key(nonce, username, password)
File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 266,
in _auth_key
digest = _password_digest(username, password)
File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 252,
in _password_digest
raise ValueError("password can't be empty")
ValueError: password can't be empty
client['localhost'].authenticate('',None, mechanism='MONGODB-CR')
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line
1013, in authenticate
validated_options)
File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 77,
in _build_credentials_tuple
raise ConfigurationError("A password is required.")
pymongo.errors.ConfigurationError: A password is required.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/f18ec8eb-fcea-44da-9d69-108abfed838a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...