What is your hint or solution suggestion?
this challenge needs to be re-written. The description is very un-clear, as well as contradicttory.

  1. It says to re-direct to ‘/’ on failure.
    "passport.authenticate can also take some options as an argument such as { failureRedirect: ‘/’ } which is incredibly useful, so be sure to add that in as well. "

  2. It says to re-direct to ‘/profile’ if it passes.
    “Add a response after using the middleware (which will only be called if the authentication middleware passes) that redirects the user to /profile.”

  3. Then it says to re-direct to ‘/’ if it passes.
    “If the authentication was successful, the user object will be saved in req.user.”

So which is it, redirect to ‘/’ or redirect to ‘/profile’.


Challenge: How to Use Passport Strategies

Link to the challenge:

I’m not sure the instructions contradict themselves?

I think you trimmed out a paragraph here:

If the authentication was successful, the user object will be saved in req.user.

At this point, if you enter a username and password in the form, it should redirect to the home page /, and the console of your server should display 'User {USERNAME} attempted to log in.', since we currently cannot login a user who isn’t registered.

Thank you for the reply,
Yes, I did trim part of the paragraph as I felt it wasn’t necessary for my question. What the question asks and what is being tested for are almost totally unrelated. The challenge question does contradict itself.
It’s a pity, as this is a good program from FCC, but most of the learning seems to be, how to understand badly worded requirements, rather than learning Node.js and express.
I did finally solve the challenge by ignoring the challenge question for the most part, and with a lot of trial and error.

My point is that I think you actually trimmed out required information.

You removed context about what “if it passes” means in the logical flow that is being requested.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.