Can't pass test in Advanced Node and Express - How to Use Passport Strategies

Can't pass test in Advanced Node and Express - How to Use Passport Strategies
0
#1

Hello! I can’t pass the test to proceed with my passport app.

The error message is: “A login attempt at this point should redirect to the homepage since we do not have any registered users.” However, I believe that my app does do that. I even tried copying and pasting the code given as the sample code, and it still doesn’t pass.

Here’s the relevant code. (The rest is the same as the sample code found at https://gist.github.com/JosephLivengood/8a335d1a68ed9170da02bb9d8f5b71d5)

app.route(’/login’)
.post(passport.authenticate(‘local’, { successRedirect: ‘/’, failureRedirect: ‘/’ }),(req,res) => {
//res.redirect(’/’); //I’ve tried using the parameter successRedirect and well as putting it here.
});

Looking at other posts about this problem, I’ve seen that the title of the page should be “Home page”, so I’ve tried changing it to that, and still had no success.

Thank you for your help!

#2

This section has a number of issues. I just went through this recently.

I can’t specifically remember how I solved this specific issue, but the solution was found in the forums on here or in the comments on one of the gists.

I had to use more than one glitch project to complete this section, three I think.

Which challenge is this, is it the one after cleaning up code with modules?

Check if at the top of the challenge if the link to the glitch starter project is different than the one you used to start and if it is use that new one.

I remember that being an issue around this point. The testing is looking for everything in just one file even through the they just had you split it up you have to go back to writing everything in the server file on the following challenge for the tests to pass.

#3

Thank you for the help! This challenge is a few before the one with cleaning up code with modules. I checked to see if the glitch starter project is the same, and it appears to be so. And everything is in the server file. I’m still stuck, but I’ll look to see if I can find anything else helpful in the forums.

#4

i’m stuck too at the same error. did you find the problem ?

#5

Hi! No, I haven’t figured it out yet. I decided to just continue, and to come back to this later. I’ve finished the rest of the unit now, with everything passing except for this part. It’s a bit frustrating.

1 Like
#6

Write “Home page” (no quotes) somewhere inside the index.pug file. For instance, I changed my success message to the following: Looks like this Home page is being rendered from Pug into HTML!

Not sure if that’s your problem though. Can you share your glitch project?

Also take a look at this issue (specifically my comment), might have something to do with it?