SteveMcArthur / docpad-plugin-authentication

Handles authentication and login functionality via social login for your docpad application. Protects pages from unauthenticated users. Uses the node module social-login (https://github.com/26medias/social-login) to standardise the configuration interface to the various login strategies and handle routing and redirection.
http://login-stevehome.rhcloud.com
Other
4 stars 1 forks source link

Issue #9 reproduced again. #11

Closed Aglezabad closed 7 years ago

Aglezabad commented 7 years ago

System specs:

Docpad specs:

Can reproduce this with Debian Testing and NodeJS (v4.9) from its repos. Same Docpad version and plugins.

Problem: Issue #9 reproduced again. When I try to login with Github auth (also occurs the same thing with Google auth), response from 3rd party auth API is ok but when they call the callback url, Docpad returns error 500.

I'm using docpad environment different from development. I've configured Github login using your examples as source. The only thing that maybe I do wrong is using localhost as hostname.

Is there something missing or wrong in my configuration? I've linked mine. Or should I set passport.initialize() at the end of serverExtend event function?

Thank you very much.

Trace:

Error: passport.initialize() middleware not in use
at IncomingMessage.req.login.req.logIn (/home/angel/Proyectos/UnivUnix-website/node_modules/passport-oauth/node_modules/passport/lib/passport/http/request.js:30:30)
at Strategy.strategy.success (/home/angel/Proyectos/UnivUnix-website/node_modules/passport/lib/middleware/authenticate.js:228:13)
at verified (/home/angel/Proyectos/UnivUnix-website/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:133:18)
at /home/angel/Proyectos/UnivUnix-website/node_modules/docpad-plugin-authentication/out/authentication.plugin.js:194:17
at findOrCreateUser (/home/angel/Proyectos/UnivUnix-website/node_modules/docpad-plugin-authentication/out/simple-membership.js:73:5)
at socialLoginClass.onAuth (/home/angel/Proyectos/UnivUnix-website/node_modules/docpad-plugin-authentication/out/authentication.plugin.js:188:15)
at Strategy._verify (/home/angel/Proyectos/UnivUnix-website/node_modules/docpad-plugin-authentication/out/social-login.js:189:15)
at /home/angel/Proyectos/UnivUnix-website/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:141:20
at /home/angel/Proyectos/UnivUnix-website/node_modules/passport-github/lib/passport-github/strategy.js:105:7
at passBackControl (/home/angel/Proyectos/UnivUnix-website/node_modules/oauth/lib/oauth2.js:125:9)
at IncomingMessage.<anonymous> (/home/angel/Proyectos/UnivUnix-website/node_modules/oauth/lib/oauth2.js:143:7)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
SteveMcArthur commented 7 years ago

@Aglezabad can you confirm that the error goes away if you remove the analytics plugin?

Aglezabad commented 7 years ago

To avoid duplicated issues, I will put my conclussion in #9 and close this.