Day 38: PassportJS and Strategies

Continued my web security studies. Was reading through the documentation of the passport package. The time I spent getting comfortable with express is really helping out right now.

I also am going through some review of React hooks. I realized after doing the knowledge test that there are still some gaps in my knowledge and especially my notes. I need to review. I am especially interested in improving my notes on the useReducer and looking into how to contruct my own custom hooks. From what I understand, constructing your own hooks is the basis for third part hooks.

So much to learn so little time.

TLDR;

Okay, so here are the highlights of what I did:

  • Backend -> Started reading through some of the concepts mentioned in the web security section. I read through the example code but I stopped to review at the authorization sections. I need to go over that a few more times before I feel comfortable with it.
  • React -> Went through the React docs on the useState and useEffect hooks. I learned some interesting points on how things work under the hood. The beta version of the React docs had some great examples for the useState section. I am trying to update my notes with more details on React hooks.

Passport Package Notes (Rough)

Passport is a JavaScript library that provides tools for performing authentication in Node.js. I will refer to it as “PassportJS” most of the time in these notes.

Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more. – Passport Website 2022

Usage

PassportJS uses over 500 different npm packages to allow for authentication with methods (a.k.a. strategies) like:

  • Username and Password (package: passport-local)
  • Facebook Account (package: passport-facebook)
  • Twitter Account (package: passport-twitter)
  • Google (OAuth)Account (package: passport-google-oauth)
  • AuthO platform (package: passport-authO)
  • JSON Web Token (package: passport-jwt)
  • etc

The idea is that you utilize the passport package alongside the specific method (strategy) packages you want to use in your Node.js middleware for requests made to the server. It seems that PassportJS is most commonly used in web frameworks built with express (I could be wrong about this).


Goal For Round 8 of the #100DaysofCode Challenge

This is my eighth round of the “#100daysofcode” challenge. I will be continuing my work from round five, six, and seven into round eight. I was working through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. My goal was to become more familiar with algorithms and data structures. This goal was derived from my goal to better understand operating systems and key programs that I use in the terminal regularly e.g. Git. This goal was in turn derived from my desire to better understand the fundamental tools used for coding outside of popular GUIs. This in turn was derived from my desire to be a better back-end developer.

I am currently putting a pause on the algorithm work to build some backend/full stack projects. I primarily want to improve my skills with the back-end from an implementation perspective. I have improved tremendously in terminal and CLI skills but I lost focus due to how abstract the algorithm concepts got. I wanted to work on things that were more tangible until I can get to a position where I could directly benefit from improving my algorithm skills and theoretical knowledge. So that’s the focus right now. Build my backend skills and prove my full stack capabilities by building some dope projects.

Again, I still have no idea if my path is correct but I am walking down this road anyways. Worst case scenario I learn a whole bunch of stuff that will help me out on my own personal projects. Best case scenario I actually become one of those unicorn developers that go on to start a billion dollar company… You never know LOL.