nickredmark / ooth

User identity/authentication/accounts management microservice for node.js
https://nmaro.github.io/ooth/
MIT License
605 stars 65 forks source link

BROKEN, DON'T MERGE: Connect to mongodb with auth turned on. #28

Closed claysquareninety closed 6 years ago

claysquareninety commented 6 years ago

Instructions from https://medium.com/@matteocontrini/how-to-setup-auth-in-mongodb-3-0-properly-86b60aeef7e8 followed.

nickredmark commented 6 years ago

A software architectural note: I'd use docker containers and something like docker-compose to link them together so it wouldn't be necessary to set up auth.

katsanva commented 6 years ago

MongoDB user/pass can be easily configured just via adding them to config files. For security purposes, it will be super awesome to have MongoDB connection secured, not only with user/pass but with an SSL also. But probably, it's a bit out of the scope of ooth.

nickredmark commented 6 years ago

I'm working on a working example right now. I really don't believe it should be a problem.

nickredmark commented 6 years ago

I added a minimal-mongo-auth example that works for me. Probably your problem was that when creating a mongodb connection the URL already needs to contain the database name (i.e. MongoClient.connect('mongodb://localhost:27017/ooth-minimal-auth') instead of MongoClient.connect('mongodb://localhost:27017')) - at least that's what did the trick for me.

Thank you for your contributions.

claysquareninety commented 6 years ago

@nmaro I will give that a shot, but pretty sure I had tried it. Thanks for the help!