User Authentication With Express and Mongo

Treehouse
Course Summary
Learn how to implement a custom user authentication system that controls users access to web resources using Node.js using Express and MongoDB. The system lets users sign up, log in, and log out, limiting access to password-protected resources. Express is a popular web framework for creating MVC applications and RESTful APIs in Node.js. Express lets developers define routes and middleware for submitting and retrieving data in our database. We will leverage the document based NoSQL database, MongoDB, to store our user data by creating a user model with mongoose. Mongoose is an open source Node package for defining data models for an application and connecting to MongoDB.
-
+
Course Description
About this Course Learn how to implement a custom user authentication system that controls users access to web resources using Node.js using Express and MongoDB. The system lets users sign up, log in, and log out, limiting access to password-protected resources. Express is a popular web framework for creating MVC applications and RESTful APIs in Node.js. Express lets developers define routes and middleware for submitting and retrieving data in our database. We will leverage the document based NoSQL database, MongoDB, to store our user data by creating a user model with mongoose. Mongoose is an open source Node package for defining data models for an application and connecting to MongoDB. What you'll learn
- What is Authentication?
- User Registration
- Pug (formerly Jade) templating engine
- Sessions
- Cookies
- Express Middleware
About the Teacher
Jonathan is a software engineer living in Rochester, NY. Jonathan loves learning new and fun ways to write software. You can find him on most websites with the username, fostertheweb.
-
+
Course Syllabus
What is Authentication?
In this stage we will start by showing the finished project in action then walk through the source code of the starter project. Before diving into the code we will first go over what authentication is and why it is important. We will demystify the authentication process and you will gain an understanding of what is going on behind the scenes when you log into a website. After that we will jump into the code of our project and start working with models and routes. 6 steps- What is User Authentication? 2:14
- Authentication and Authorization 3:11
- Review: Authentication and Authorization 5 questions
- Preview the Project 2:02
- Setting Up the Project 4:53
- Review: Node, Express and npm 6 questions
User Registration
Let’s continue to develop our project by adding routes and views to our Express application. We will use the default templating engine, Jade, to create a registration form. You will also learn how to tie our application into MongoDB using Mongoose, what hashing and salting are, and how they fit into an authentication process. Finally, we will improve our user model with methods and validation while using the Node bcrypt module. 11 steps Now that we have the logic in place to create and authenticate users, how do we know if the user is logged in? Well, that is where sessions come in. A way of identifying a user will be stored in the session. We will know who the user is as they navigate through the website. Cookies can be used to store this information, and that is what we will show you how to use in this stage. 9 stepsImproving the App with Custom Middleware
We are almost done with our authentication system! Now that users can register and login and you have sessions to identify the user we need to think about security. Right now anyone that can access the site can navigate to any of the routes whether they are logged in or not. With middleware we can make sure that doesn’t happen. 9 steps