title: throw new TypeError('OAuth2Strategy requires a verify callback');
body: <p>So I am learning about node.js and facebook authentication, and I ran into this error:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-oauth2/lib/strategy.js:79
    if (!verify) { throw new TypeError('OAuth2Strategy requires a verify callback'); }
                   ^
  
  TypeError: OAuth2Strategy requires a verify callback
      at Strategy.OAuth2Strategy (/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-oauth2/lib/strategy.js:79:24)
      at new Strategy (/home/lindan4/Git/HelloNodeJS/ChatTime/node_modules/passport-facebook/lib/strategy.js:55:18)
      at module.exports (/home/lindan4/Git/HelloNodeJS/ChatTime/app/auth/index.js:42:16)
      at Object.&lt;anonymous&gt; (/home/lindan4/Git/HelloNodeJS/ChatTime/server.js:3:22)
      at Module._compile (internal/modules/cjs/loader.js:707:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
      at Module.load (internal/modules/cjs/loader.js:605:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
      at Function.Module._load (internal/modules/cjs/loader.js:536:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
      at startup (internal/bootstrap/node.js:308:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here's the code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>'use strict';
  
  const passport = require('passport');
  const config = require('../config');
  const FacebookStrategy = require('passport-facebook').Strategy;
  
  const helper = require('../helpers');
  
  module.exports = () =&gt; {
  
    passport.serializeUser((user, done) =&gt; {
      done(null, user.id);
    });
  
  
    passport.deserializeUser((id, done) =&gt; {
      helper.findById(id).then(user =&gt; {
        done(null, user);
      }).catch('Error deserializing user');
    });
  
    //Issue is here
    let authProcessor = (accessToken, refreshToken, profile, done) =&gt; {
        //Find a user in the local MongoDB instance using the profile.id
  
  
        helper.findRecord(profile.id).then(result =&gt; {
          if (result)
          {
            done(null, result);
          }
          else
          {
              //Create a new user and return
              helper.createNewUser(profile).then(newChatUser =&gt; {
                done(null, newChatUser)
              }).catch(error =&gt; console.log('Error when creating new user'));
          }
        });
    }
  
    passport.use(new FacebookStrategy(config.fb), authProcessor);
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The error lies in this line:</p>
  
  <pre><code> passport.use(new FacebookStrategy(config.fb), authProcessor);
  </code></pre>
  
  <p>I have looked on google and Stack Overflow and have yet to find a solution. I was hoping that someone could perhaps assist me. For your reference, the "config" module is implemented as shown below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>'use strict';
  
  const devEnv = require('./development.json');
  
  if (process.env.NODE_ENV === 'production')
  {
    //Offer production stage environment variables
    module.exports =
    {
      host: process.env.host || "",
      dbURI: process.env.dbURI,
      sessionSecret: process.env.sessionSecret,
      fb: {
        clientID: process.env.fbClientID,
        clientSecret: process.env.fbClientSecret,
        callbackURL: process.env.host + "auth/facebook/callback",
        profileFields: ['id', 'displayName', 'photos']
      }
    }
  }
  else
  {
    //Offer dev stage and data
    module.exports = {
      host: devEnv.host,
      dbURI: devEnv.dbURI,
      sessionSecret: devEnv.sessionSecret
    }
  }</code></pre>
  </div>
  </div>
  </p>