aboutsummaryrefslogtreecommitdiffstats
path: root/passport.js
blob: 1395614b7df1900c5ef691da89fcda6d57ce3e76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const passport = require('passport')
const jwt = require('passport-jwt')

passport.use(new jwt.Strategy({
    jwtFromRequest: jwt.ExtractJwt.fromAuthHeader(),
    secretOrKey: process.env.SECRET
  }, (payload, next) => {
    const user = {} // todo 
    if (user) {
      next(null, user)
    } else {
      next(null, false)
    }
  })
)

module.exports = passport