Advanced Node Social Auth II

Tell us what’s happening:
Can’t get Social Auth 2 to pass at all. I’ve got every other challenge in the section to pass, But this one keeps failing on the “GitHub strategy should be set up correctly thus far.” test case. I’ve even tried just flat out copy-pasting the code in the finished example: https://gist.github.com/camperbot/ff3a1166684c1b184709ac0bee30dee6 into my auth.js, but that still doesn’t make it pass. Does anyone know how to get this test case to pass?

Your code so far

/* eslint-disable */

const passport = require("passport");

const LocalStrategy = require("passport-local");

const bcrypt = require("bcrypt");

const ObjectID = require("mongodb").ObjectID;

const GitHubStrategy = require("passport-github").Strategy;

module.exports = function (app, myDataBase) {

  passport.serializeUser((user, done) => {

    done(null, user._id);

  });

  passport.deserializeUser((id, done) => {

    myDataBase.findOne({ _id: new ObjectID(id) }, (err, doc) => {

      if (err) return console.error(err);

      done(null, doc);

    });

  });

  passport.use(

    new LocalStrategy(function (username, password, done) {

      myDataBase.findOne({ username: username }, function (err, user) {

        console.log("User " + username + " attempted to log in.");

        if (err) {

          return done(err);

        }

        if (!user) {

          return done(null, false);

        }

        if (!bcrypt.compareSync(password, user.password)) {

          return done(null, false);

        }

        return done(null, user);

      });

    })

  );

  passport.use(

    new GitHubStrategy(

      {

        clientID: process.env.GITHUB_CLIENT_ID,

        clientSecret: process.env.GITHUB_CLIENT_SECRET,

        callbackURL:

          "https://boilerplate-advancednode.your-username.repl.co/auth/github/callback",

      },

      function (accessToken, refreshToken, profile, cb) {

        console.log(profile);

        // Database logic here with callback containing our user object

      }

    )

  );

};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36.

Challenge: Implementation of Social Authentication II

Link to the challenge:

Welcome, Zireael.

Would you mind sharing a link to your project?

Which tests are you failing? What do the app logs/console say? Can you see any errors in the browser console, on the page where you submit the link?