Integrating Express-Session and Passport.js | Node Auth Tut - Part 5
Chris Courses
🚀View the updated 2020 Sessions tutorial at: https://chriscourses.com/courses/build-web-apps/express-session
🖥Professional Web Development Services from Chris: https://resovere.com/
We know sessions are a place in which we can store data on our app's backend. We also know that session packages typically return to the user a cookie that associates them with their corresponding session. However, what we don't know is how to use a session to "log a user in" to our app.
When it comes to logging a user in, we need to have some way to test whether or not the cookie within a user's browser matches up with the session created within our app's backend. Integrating this yourself can be a little tricky, but it's much easier when using something like Passport.js. Passport.js is able to determine whether or not a user is logged in based on the sessions our app possesses. Learn how to combine Passport.js with express-session to finally create a user that's deemed "logged in."
Video Timeline:
00:00 - Installing express-session 05:55 - Installing Passport.js 07:26 - Adding a login function to user registration 11:00 - Integrating sessions with passport.js (serialize and deserialize user) 15:18 - Viewing session authentication data in the console 16:00 - Why we need to add session storage to our database when developing
The Platform:
http://chriscourses.com is a platform in progress whose goal is to educate aspiring and seasoned web developers via story driven learning.
Each course tells a different story, and each milestone reveals a different scene. With an expansive universe to explore, you can track your progress, and gain the necessary skills needed to build your dreams.
For updates on the progress of chriscourses.com and future videos, join the Chris Courses mailing list at http://chriscourses.com.
Support Chris Courses Through Patreon:
https://www.patreon.com/chriscourses
Chris Courses Social:
Twitter: https://twitter.com/chriscourses Facebook: https://www.facebook.com/chriscourses
Christopher Lis Social:
Twitter: https://twitter.com/christopher4lis CodePen: http://codepen.io/christopher4lis
Beats:
Joakim Karud - Looking To The Sky w/Peter Kuli & Kasey Andre ... https://www.youtube.com/watch?v=hNinO6-bDVM
60628648 Bytes