Since I started learning web development I’ve had this notion that authentication – the ability to set up and log in to an account created on a site, was really hard to implement, and that it would be out of my grasp for a long, long time.
Authentication using a node package- Passport, was covered in the Udemy course I’m currently enrolled in. The lecturer explained that you can implement authentication from scratch, but that it’s a lot more work, and typically a pre-made package is used instead to do most of the heavy work for you.
As instructed, I installed Passport and included it in my app as a dependency. Because we were going to create local accounts, and not connect accounts from other sites (you can set it up to connect to users facebook, twitter, or a bunch of other accounts,) we also installed Passport Local. After that, it was a matter of including a few lines of code to implement authentication! Swanky.
I found a really great series of videos today that goes through form validation and implementing authentication with Passport, you can check out the videos here. It’s a three video series but if you’re at a similar stage as I am right now (learning about authentication, starting to implement it,) I would highly recommend watching it. Brad, the video’s instructor, creates an app from scratch to demonstrate how to use Passport and validation without making the app unnecessarily big or complicated. The videos are comprehensive, and target the authentication and validation more specifically than the course I’m doing- where we haven’t actually implemented any validation yet!