SlideShare a Scribd company logo
Session Management &
                     Authentication with Node
                               Kianosh Pourian
                             twitter: @kianoshp
                           blog: innovatorylife.com




Thursday, January 17, 13
Purpose
                     •     To be able to authenticate users through:

                           •   login and password

                           •   third party validation

                               •   twitter

                               •   facebook

                               •   linkedin

                               •   github

                     •     Manage sessions



Thursday, January 17, 13
Options

                     • EveryAuth
                     • Passport
                     • Custom made
                      • connect-auth

Thursday, January 17, 13
Passport - installation & configuration

                     •      Modules needed

                           •   passport

                           •   passport-local

                     •      Configuration

                           •   Authenticate

                           •   Sessions



Thursday, January 17, 13
Pitfalls
                     •     req.flash - https://github.com/visionmedia/express/
                           wiki/Migrating-from-2.x-to-3.x

                           •   connect-flash

                     •     DB for session management

                           •   Redis - http://stackoverflow.com/questions/
                               12947965/nodejs-passport-js-redis-how-to-
                               store-sessions-in-redis?lq=1

                           •   MongoDB



Thursday, January 17, 13
Pitfalls (continued)
                     •     Order of configuration

                           •   The order that you pass things to app.use
                               determines the order in which each
                               middleware is given the opportunity to
                               process a request.

                           •   place app.use(...static) at the top in order to
                               avoid parsing and authenticating them
                               through passport.



Thursday, January 17, 13

More Related Content

PPTX
Secure Coding for NodeJS
PPTX
Introduction to node.js GDD
ODP
Node.js architecture (EN)
PDF
Reactive Web-Applications @ LambdaDays
PPTX
ASP.NET WEB API
PDF
Anatomy of a Modern Node.js Application Architecture
PDF
Nodejs Explained with Examples
KEY
Node.js - Best practices
Secure Coding for NodeJS
Introduction to node.js GDD
Node.js architecture (EN)
Reactive Web-Applications @ LambdaDays
ASP.NET WEB API
Anatomy of a Modern Node.js Application Architecture
Nodejs Explained with Examples
Node.js - Best practices

More from Kianosh Pourian (7)

PPTX
Unbloat your SDLC
PDF
Would you like some Grids with that?
PPT
Introvert & extrovert: The melting pot of development
KEY
Why are preprocessors divisive
KEY
Intro to KnockoutJS
KEY
Intro to SASS CSS
KEY
Advanced sass
Unbloat your SDLC
Would you like some Grids with that?
Introvert & extrovert: The melting pot of development
Why are preprocessors divisive
Intro to KnockoutJS
Intro to SASS CSS
Advanced sass
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
Teaching material agriculture food technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Network Security Unit 5.pdf for BCA BBA.
Dropbox Q2 2025 Financial Results & Investor Presentation
Building Integrated photovoltaic BIPV_UPV.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
NewMind AI Monthly Chronicles - July 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Ad

Passport Nodejs Lightening Talk

  • 1. Session Management & Authentication with Node Kianosh Pourian twitter: @kianoshp blog: innovatorylife.com Thursday, January 17, 13
  • 2. Purpose • To be able to authenticate users through: • login and password • third party validation • twitter • facebook • linkedin • github • Manage sessions Thursday, January 17, 13
  • 3. Options • EveryAuth • Passport • Custom made • connect-auth Thursday, January 17, 13
  • 4. Passport - installation & configuration • Modules needed • passport • passport-local • Configuration • Authenticate • Sessions Thursday, January 17, 13
  • 5. Pitfalls • req.flash - https://github.com/visionmedia/express/ wiki/Migrating-from-2.x-to-3.x • connect-flash • DB for session management • Redis - http://stackoverflow.com/questions/ 12947965/nodejs-passport-js-redis-how-to- store-sessions-in-redis?lq=1 • MongoDB Thursday, January 17, 13
  • 6. Pitfalls (continued) • Order of configuration • The order that you pass things to app.use determines the order in which each middleware is given the opportunity to process a request. • place app.use(...static) at the top in order to avoid parsing and authenticating them through passport. Thursday, January 17, 13