-
-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoDB user authorization - how-to #1168
Comments
What happens if you use a db other than |
I'm experiencing the same issue. I have Eve connected to a mongodb replica set, and that was working up until I enabled auth. Now when I altered my URI to include username and password, I get that exact same error. I have tried the exact URI that I give to eve directly on Mongo and it works properly:
Just for kicks, I also tried creating a MongoClient object with the same URI, and it was able to succesfully connect to Mongo, so I think the problem is with eve. EDIT: After much struggle, and making use of several options not mentioned directly in the documents, I managed to get it to work, using the following options:
And making absolutely sure that Part of the problem was that the application error was always the same "Authentication Failed", but when I would look at the response.json() from the request I had made, it would have a more informative failure message. |
I am having the same issue. Trying to use the mongo_srv protocol with eve. I can manually connect to pymongo in my Eve app but I get the same "Authentication Failed' error. Does that mean I can't currently use the mongo+srv protocol with Eve? |
v0.7.10 pinned the PyMongo dependency, see #1172. Can you guys please let me know if this is still a problem with Eve 0.7.10+? |
I was experiencing the same problems and added I am running Eve 0.8. |
Thanks, everyone, for looking into it. It would be nice if the docs were updated somehow to account for this scenario. Anyone up for the task? |
Actually, the configuration page does list @xibriz was adding |
@nicolaiarocci Testet now, I don't use the
I only read the Quickstart docs so it would be nice if it was reflected there since it has an example with |
I think MONGO_AUTH_SOURCE = "admin" is actually not the right config. MONGO_AUTH_SOURCE should be the name of the database on which the user can be authenticated.While the description in the document section "Database Interlude" may cause misunderstanding. |
@lidanger Yes, I think you are correct. Feel free to submit a PR I will be happy to review it. |
Expected Behavior
Configuring MONGO_* settings with user authorization should not raise an error if the database does not exist.
First step, configure mongodb
I set-up a recent mongodb instance locally and I create an administrator user:
I configure mongo in authorization mode and restart the server:
As of now, I always need to authenticate for any operation on the databases
Second step, configure my REST Eve backend:
My configuration file MONGO part
Note: it is a JSON file that is transformed to a python dict...
Also note: that I checked that the same configuration without any authorization is fully functional.
Actual Behavior
Tell us what happens instead.
It looks like Eve do not consider the authorization parameters I provided to create the database!
I tried almost every parameters combination, with or whitout
MONGO_URI
. The only solution I found to start correctly is to remove mongo authorization and then restore once my database is created .with a user that is authorized to use this db ...Perharps I did something not correctly ... but what I expect is that Eve manages the DB creation by itself 😉
Environment
The text was updated successfully, but these errors were encountered: