Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed REST API Authentication with Express!

Instruction

Handle Failed User Authentication

To finish the authenticateUser() middleware function, you'll add else clauses to your if statements to handle each expected failure. Inside each else clause, you'll set a message variable that describes the failure. Then, at the bottom of the function, you'll check whether message has a value. At the top of the authenticateUser() function, use the let keyword to declare a message variable: ...