Implementation of Social Authentication II - Tests passing but not logging my profile

Tell us what’s happening:
As Title the tests pass however the console doesn’t log my profile information?

Your code so far

Your browser information:

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

Challenge: undefined

Link to the challenge:
https://www.freecodecamp.org/learn/information-security-and-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii

I’m trying to figure out what you mean. Can you clarify?

From your glitch I can see that you might be missing the callback function of the authenticate method of passport on line 74. The server is not sending a response.

http://www.passportjs.org/docs/authenticate/

Hey thanks for having a look ill try and explain using a quote from the task:

Your authentication won’t be successful yet, and actually throw an error, without the database logic and callback, but it should log to your console your GitHub profile if you try it! Submit your page when you think you’ve got it right.

So to me that is saying that the auth will not work currently due to missing a callback however it will log my profile name to my console with the console.log(profile) however my console doesnt log anything profile or if i change it to a string ‘hello’ for instance it wont print that so im guessing its never reaching that part of the codeblock rather than profile variable not existing, code below

an added note is the way I’ve setup my environment variables is VARIABLE_NAME=‘code from github’ so there set as strings (as u cant see them in the file)

  passport.use(new GitHubStrategy({
  clientID: process.env.GITHUB_CLIENT_ID,
  clientSecret: process.env.GITHUB_CLIENT_SECRET,
  callbackURL: 'https://maize-parakeet.glitch.me/auth/github/callback'
},
  function(accessToken, refreshToken, profile, cb) {
   console.log(profile)  //This Line
    
  }
));

ive figured out my mistake and passed it

Hi, I’m running into the same issue as well. Would you mind to share your discovery?

1 Like