sydjs-site icon indicating copy to clipboard operation
sydjs-site copied to clipboard

passport.initialize() middleware not in use

Open martonic opened this issue 10 years ago • 4 comments

I cloned the site to bitnami mean stack 64-bit on EC2.

  • mongoDB 2.6.0
  • RockMongo 1.1.5
  • Apache 2.4.9
  • PHP 5.4.26
  • Node.js 0.10.26

The clone works, but I can't join with Facebook (this is not a problem on the official site, it is only a problem on the cloned site).

I put valid Cloudinary and Facebook credentials in the .env file.

Here are the diagnostics.

Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn (/home/bitnami/sydjs/node_modules/passport-google-oauth/node_modules/passport-oauth/node_modules/passport/lib/passport/http/request.js:30:30) at Strategy.strategy.success (/home/bitnami/sydjs/node_modules/passport/lib/middleware/authenticate.js:228:13) at verified (/home/bitnami/sydjs/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:179:18) at Strategy._verify (/home/bitnami/sydjs/lib/auth/facebook.js:27:3) at /home/bitnami/sydjs/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:195:22 at /home/bitnami/sydjs/node_modules/passport-facebook/lib/strategy.js:183:5 at passBackControl (/home/bitnami/sydjs/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:126:9) at IncomingMessage. (/home/bitnami/sydjs/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13)

Any will be tremendously appreciated!

martonic avatar Jul 02 '14 16:07 martonic

Not sure if you still have this issue but I had something similar and was able to fix it by fixing my callback URL.

I changed it from ..../facebook?callback to /facebook?cb

misterGF avatar Jul 21 '14 20:07 misterGF

Hi Gil,

Yes, I still have this problem, and have been wondering if the callback URL has something to do with it.

I have this variable in my .env file:

FACEBOOK_CALLBACK_URL=http://mysite.com/auth/facebook/

Is that wrong? (of course "mysite.com" has been replaced)

Which callback URL are you referring to - in which file?

Many thanks,

Marty Hirsch

-----Original Message----- From: Gil Ferreira [email protected] To: JedWatson/sydjs-site [email protected] Cc: Marty Hirsch [email protected] Sent: Mon, Jul 21, 2014 1:22 pm Subject: Re: [sydjs-site] passport.initialize() middleware not in use (#29)

Not sure if you still have this issue but I had something similar and was able to fix it by fixing my callback URL. It changed it from ..../facebook?callback to /facebook?cb — Reply to this email directly or view it on GitHub.

martonic avatar Jul 21 '14 23:07 martonic

Marty,

I'm referring to the FACEBOOK_CALLBACK_URL variable you have in your .env file.

I have it set to FACEBOOK_CALLBACK_URL='http://mysite.com/auth/facebook?cb'

Try adding the ?cb to the end of your callback url (and remove the trailing /) and restart node.

misterGF avatar Jul 21 '14 23:07 misterGF

Hi Gil,

That works - thanks a million!

Cheers, Marty

-----Original Message----- From: Gil Ferreira [email protected] To: JedWatson/sydjs-site [email protected] Cc: Marty Hirsch [email protected] Sent: Mon, Jul 21, 2014 4:47 pm Subject: Re: [sydjs-site] passport.initialize() middleware not in use (#29)

Marty, I'm referring to the FACEBOOK_CALLBACK_URL variable you have in your .env file. I have it set to FACEBOOK_CALLBACK_URL='http://mysite.com/auth/facebook?cb' Try adding the ?cb to the end of your callback url (and remove the trailing /) and restart node. — Reply to this email directly or view it on GitHub.

martonic avatar Jul 22 '14 17:07 martonic