Conflict with passport
mweibel opened this issue · 1 comments
mweibel commented
Hi,
have you ever used passport with resource-juggling together?
It seems that they conflict with each other. I don't really know why until know but I might be able to figure out why exactly.
When I configure a model to be served with resource-juggling, passport doesn't work anymore because of this error:
/Users/michael/code/BA/code/node_modules/passport/lib/passport/http/request.js:30
if (!this._passport) throw new Error('passport.initialize() middleware not i
^
Error: passport.initialize() middleware not in use
at IncomingMessage.req.login.req.logIn (/Users/michael/code/BA/code/node_modules/passport/lib/passport/http/request.js:30:30)
at Context.module.exports.delegate.success (/Users/michael/code/BA/code/node_modules/passport/lib/passport/middleware/authenticate.js:194:13)
at Context.actions.success (/Users/michael/code/BA/code/node_modules/passport/lib/passport/context/http/actions.js:21:25)
at verified (/Users/michael/code/BA/code/node_modules/passport-facebook/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:133:18)
at /Users/michael/code/BA/code/app.js:90:6
at ModelConstructor.AbstractClass.save (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/abstract-class.js:644:25)
at ModelConstructor.next (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/hookable.js:44:18)
at AbstractClass.save (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/abstract-class.js:643:30)
at ModelConstructor.AbstractClass.create (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/abstract-class.js:211:25)
at ModelConstructor.next (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/hookable.js:44:18)
at ModelConstructor.AbstractClass.create (/Users/michael/code/BA/code/node_modules/jugglingdb/lib/abstract-class.js:209:22)
at PG.create (/Users/michael/code/BA/code/node_modules/jugglingdb-postgres/lib/postgres.js:67:9)
at PG.query (/Users/michael/code/BA/code/node_modules/jugglingdb-postgres/lib/postgres.js:49:9)
at p.handleReadyForQuery (/Users/michael/code/BA/code/node_modules/jugglingdb-postgres/node_modules/pg/lib/query.js:96:10)
at p.connect.con.on.self.activeQuery (/Users/michael/code/BA/code/node_modules/jugglingdb-postgres/node_modules/pg/lib/client.js:130:24)
at EventEmitter.emit (events.js:126:20)
at Socket.p.attachListeners (/Users/michael/code/BA/code/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:86:12)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)
mweibel commented
Ok after seeing jaredhanson/passport#51 I moved my resource definitions after passport initialization and it works now.