3. Using Passport.js
Using Passport.js for authentification 1.10/1.55
common use ใน node authen , http://www.passportjs.org
provide – authen fn
เรียกว่า strategy , มีมากกว่า 500 strategies available
strategyคือ plugable authen modules , install separately
passort -cover variety of backend or use cases from – local authen- mostly use กับ authen against local db
-มีหลาย 3rd party system , รวมถึง things , non-provider
-log-ins for social medial accounts like – Facebook ,Github
หรือแบบ exotic system eg Shibboleth
เมื่อ success authen -> มันจะ store user
– serialize
– deserialized
และ session – restore ทุกๆ request
ต้อง hooked เข้าไปใน application c 2 middleware fn
สิ่งที่ middleware fnทำคือ (ใช้ passport in Express)
passport.initialize();
passport.session();
