All passport strategies follow the same pattern:
- First initialize and pass to passport:
passport.use ( new Whatever.Strategy( params) )
- Call it for authentication:
passport.authenticate( 'thestrategy' )
All strategies conform to this pattern. ...all except the built in session strategy. I advice that you change the api of the built in session strategy to conform to this convention as well. This would lead to simpler api, and less time for newbies to adapt.
Instead of :
app.use( passport.session() )
Do this:
app.use( passport.authenticate('session') )
Instead of:
passport.serializeUser(...) and
passport.deserializeUser(...)
Do this:
passport.use( new SessionStrategy( serializer, deserializer))
All passport strategies follow the same pattern:
passport.use ( new Whatever.Strategy( params) )
passport.authenticate( 'thestrategy' )
All strategies conform to this pattern. ...all except the built in session strategy. I advice that you change the api of the built in session strategy to conform to this convention as well. This would lead to simpler api, and less time for newbies to adapt.
Instead of :
app.use( passport.session() )
Do this:
app.use( passport.authenticate('session') )
Instead of:
passport.serializeUser(...) and
passport.deserializeUser(...)
Do this:
passport.use( new SessionStrategy( serializer, deserializer))