Passed the test with code structure like this :
/*
* ADD YOUR CODE BELOW
*/
app.route("/auth/github").get(passport.authenticate("github"));
app.route('/auth/github/callback').get(passport.authenticate('github', {failureRedirect: '/'}),
(req, res) => {
res.redirect('/profile');
});
passport.use(new GitHubStrategy(
{
clientID: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
callbackURL: "https://maroon-sugary-supernova.glitch.me/auth/github/callback"
},
function(accessToken, refreshToken, profile, cb) {
console.log(profile);
//Database logic here with callback containing our user object
db.collection("socialusers").findAndModify(
{ id: profile.id },
{},
{
$setOnInsert: {
id: profile.id,
name: profile.displayName || "John Doe",
photo: profile.photos[0].value || "",
email: profile.emails[0].value || "No public email",
created_on: new Date(),
provider: profile.provider || ""
},
$set: {
last_login: new Date()
},
$inc: {
login_count: 1
}
},
{ upsert: true, new: true },
(err, doc) => {
return cb(null, doc.value);
}
);
}
)
);
/*
* ADD YOUR CODE ABOVE
*/
This line passport.use(new GitHubStrategy(
I think was the problem.