Advanced Node and Express - Implementation of Social Authentication III

Ok, I’ve to admit that now I feel stuck, the tests are passing but I am not getting the result I want… The GitOAuth isn’t working as expecting. Am I missing something?
I can’t get it to work and get the access using github.
I am getting not found and if I try using the same exact code as in the solution it redirect me to a nonexistent GitHub page.
   a(href='/auth/github') Login with Github!

I tried skipping to later challenges but everything is so confusing, it seems like something is missing in the instructions from that point.

Is it just me? I am going to watch some videos on OAuth using express and passport etc… maybe I can understand why it doesn’t work as expected. I’ve been spoon fed and now I don’t have a clue on how to continue because some instructions are missing.

C’mon it’s only 7 challenges left and I’ll have completed all the 7 challenge certifications (even if I have to admit I have skipped the back-end projects but that doesn’t mean it won’t work at them in the future).
I liked the last certificate section a lot, it’s really interesting.

I haven’t completed the back-end and some front-end projects because I wanted to get an idea of everything. And in all honestly I need to focus on front-end development but I like express and the other back-end technologies a lot compared to when I learned PHP and mySQL.

Did you change your starter project on Glitch before running “Implementation of Social Authentication I”?

It was really easy for me to pass this 3 tests successfully.

It’s not really about passing the tests. It’s about it not working as it should.

I am afraid it’s the same for me. Tests passing, however “504 Gateway Time-out” error occurs every time I try to login with GitHub.

I am sorry I will not be able to answr your question but as I am new to this just startted with node I am getting things but I dnt kknow how to use that glitch

I see, we’ll see if someone will help us solve our problem. mLab is moving to MongoDB website so I think they should also update the challenges.

In my case after I authorize the user the app doesn’t redirect me to the profile. It throws an error that sais " Cannot read property ‘0’ of undefined". Have you found the solution to this problem?


Did you figure it out? I’m having the same issue.

Yeah. In the part where it has to look for the email just comment it out or just leave the part with the alternative message.

1 Like

To anyone who is struggling with this exercise. Try running the code in server.js in the right place (before routes). Exporting seems to mess with checking the requirements. The same thing happened in the previous exercise. Hope that helps.

I was having the same issue, getting an error and not being redirected to the profile. I ended up updating my reference to mongodb in package.json, then fixing an issue with database object no longer being an argument to the connect callback (, and everything worked for me after that.

1 Like

I also came across this issue when I was completing this challenge. Looking at the console.log for the profile that is returned from GitHub, it seems like if the user has their email set to private, then that array just doesn’t exist. My solution was to add a ternary operation to check if the email array exists before trying to access it. If that array exists, then pull the user’s email address from there. If the email array doesn’t exist then use a default message (like, “No email”)

Within the $setOnInsert object, I set my ‘email’ attribute like this:

email: profile.emails ? profile.emails[0].value : 'No email'

Everyone’s code is passing and not working but meanwhile my code is working and not passing. Here’s my glitch. What could be wrong with it to not pass?

1 Like

Testing and debugging is so weird on this last section. Basically I have to copy/paste the code exactly or my code doesn’t work. That’s how I fixed it. I copy/pasted everything and changed the callback url

1 Like

I am having the same issue, tested a fair bit manually and is constantly failing the tests

Finally got there, it is quite finicky as currently the tests rely on quite specific formatting in the server.js file. Steps to reproduce:

  1. Copy the example project server.js and package.json from here:!/guttural-birch
  2. Copy and paste the snippet in this issue comment to ensure that the '/auth/github/callback' route is formatted in a specific way
  3. Retry until it works! :pray: