Skip to content

Advicing to change of API of built in session strategy #736

Description

@DenizBasgoren

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions