bnoguchi / everyauth

node.js auth package (password, facebook, & more) for Connect and Express apps
http://everyauth.com/
3.49k stars 447 forks source link

Error accessing github with oauth2. #471

Closed romankor closed 10 years ago

romankor commented 10 years ago

I am trying to use Doorman app that uses everyauth underneath. When trying to authenticate with github oauth i am getting the following error. Where can i configure this function ?

Error: WARNING: You are trying to access the attribute/method configured by `findUserById`, which you did not configure. Time to configure it.
    at EveryModule.(anonymous function) [as findUserById] (/opt/doorman/node_modules/everyauth/lib/modules/everymodule.js:133:13)
    at fetchUserFromSession (/opt/doorman/node_modules/everyauth/index.js:95:43)
    at Object.handle (/opt/doorman/node_modules/everyauth/index.js:43:5)
    at next (/opt/doorman/node_modules/connect/lib/http.js:203:15)
    at Object.checkUser [as handle] (/opt/doorman/app.js:40:5)
    at next (/opt/doorman/node_modules/connect/lib/http.js:203:15)
    at next (/opt/doorman/node_modules/connect/lib/middleware/session.js:323:9)
    at /opt/doorman/node_modules/connect/lib/middleware/session.js:342:9
    at /opt/doorman/node_modules/connect/lib/middleware/session/memory.js:52:9
    at process._tickCallback (node.js:343:11)
Afterglow commented 10 years ago

I just got the same error using google so whatever causes it isn't limited to github logins

Error: WARNING: You are trying to access the attribute/method configured by `findUserById`, which you did not configure. Time to configure it.
    at EveryModule.(anonymous function) [as findUserById] (/opt/doorman/node_modules/everyauth/lib/modules/everymodule.js:133:13)
    at fetchUserFromSession (/opt/doorman/node_modules/everyauth/index.js:95:43)
    at Object.handle (/opt/doorman/node_modules/everyauth/index.js:43:5)
    at next (/opt/doorman/node_modules/connect/lib/http.js:203:15)
    at Object.checkUser [as handle] (/opt/doorman/app.js:40:5)
    at next (/opt/doorman/node_modules/connect/lib/http.js:203:15)
    at next (/opt/doorman/node_modules/connect/lib/middleware/session.js:323:9)
    at /opt/doorman/node_modules/connect/lib/middleware/session.js:342:9
    at /opt/doorman/node_modules/connect/lib/middleware/session/memory.js:52:9
    at process._tickCallback (node.js:419:13)
bnoguchi commented 10 years ago

Assuming you're using express 3.x (not 4.x), please refer to https://github.com/bnoguchi/everyauth#accessing-the-user

everyauth.everymodule.findUserById( function (userId, callback) {
  User.findById(userId, callback);
  // callback has the signature, function (err, user) {...}
});
Afterglow commented 10 years ago

From what I could see I think this bug should probably be filed against Doorman not everyauth. Thanks for the explanation.