onepiecejs / nodejs-cantas

Cantas is a real-time collaborative web application. Official repository
Other
202 stars 134 forks source link

Fail to login with Google #77

Open tkdchen opened 9 years ago

tkdchen commented 9 years ago

I run Cantas on develop branch from nodejs in my development environment. When click "Log in with Google", error occurs.

500 Error: Unknown authentication strategy "google"

    at attempt (/home/cqi/projects/nodejs-cantas/node_modules/passport/lib/middleware/authenticate.js:166:37)
    at authenticate (/home/cqi/projects/nodejs-cantas/node_modules/passport/lib/middleware/authenticate.js:342:7)
    at callbacks (/home/cqi/projects/nodejs-cantas/node_modules/express/lib/router/index.js:272:11)
    at param (/home/cqi/projects/nodejs-cantas/node_modules/express/lib/router/index.js:246:11)
    at pass (/home/cqi/projects/nodejs-cantas/node_modules/express/lib/router/index.js:253:5)
    at Router._dispatch (/home/cqi/projects/nodejs-cantas/node_modules/express/lib/router/index.js:280:5)
    at Object.Router.middleware [as handle] (/home/cqi/projects/nodejs-cantas/node_modules/express/lib/router/index.js:45:10)
    at next (/home/cqi/projects/nodejs-cantas/node_modules/express/node_modules/connect/lib/http.js:204:15)
    at SessionStrategy.strategy.pass (/home/cqi/projects/nodejs-cantas/node_modules/passport/lib/middleware/authenticate.js:318:9)
    at SessionStrategy.authenticate (/home/cqi/projects/nodejs-cantas/node_modules/passport/lib/strategies/session.js:67:10)
tkdchen commented 9 years ago

This is not a bug by inspecting the code due to the google section does not get configured well yet.

Why is "Unknown authentication strategy" error raised? CantasGoogleStrategy is only initialized when all Google authentication related configuration items are set properly. I didn't configure any of them, then the error occurs.

However, this problem is supposed to be improved from the usability aspect. When user does not enable the Google authentication, or there is any wrong or missed configuration, "Log in with Google" link should not appear in the login page. Thus, user can't be confused.