vinialbano / passport-magic-link

Magic Link authentication for Passport JS
MIT License
60 stars 9 forks source link

tokenField lookup in req.params #7

Closed phof closed 1 year ago

phof commented 4 years ago

It allows the tokenField to be part of the URL path, i.e.:

passport.use(
  new MagicLinkStrategy(
    {
      secret: 'some-secret',
      userFields: ['email'],
      tokenField: 'accessToken',
    },
    (req, user, token) => {
      // sendToken
    },
    (user) => {
      // verifyUser
    }
  )
)

...

app.get(
  '/auth/:accessToken',
  passport.authenticate('magiclink', { action: 'acceptToken' }),
  (req, res) => res.redirect('/')
)

@vinialbano, thoughts?

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 35


Totals Coverage Status
Change from base Build 34: 0.01%
Covered Lines: 103
Relevant Lines: 104

💛 - Coveralls