Reputation: 5148
I have a mongoose and connect-mongo module instance in ym app. I am using the connect-mongo module to have a session store persisted in a mongodb database (mongohq) instead of a memory store.
Everytime I try to access my app when the server is launched (facebook auth with everyauth) I get the following:
500 MongoError: Error: unauthorized db:express-sessions lock type:-1 client:199.192.242.4
My user name, password are good.
var conf = {
db: {
db: 'express-sessions',
host: 'staff.mongohq.com',
port: 10072, // optional, default: 27017
username: 'admin', // optional
password: 'admin', // optional
collection: 'facebookSessions' // optional, default: sessions
},
secret: '076ee61d63aa10a125ea872411e433b9'
};
app.use(express.session({
secret: conf.secret,
maxAge: new Date(Date.now() + 3600000),
store: new MongoStore(conf.db)
}));
Edit, this seems to be an issue with my mongohq. I modified the collection for an older one and it works.
Upvotes: 2
Views: 1630
Reputation: 2425
I was facing a similar error using Heroku and Mongolab.
I resolved it by manually create a new database user with the mongolab web admin.
Upvotes: 3
Reputation: 10780
It sounds like the db was started with --auth but the user has not been granted access to the db.
http://www.mongodb.org/display/DOCS/Security+and+Authentication
Upvotes: 0