mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
23 lines
464 B
JavaScript
23 lines
464 B
JavaScript
import passport from 'passport'
|
|
import PasswordStrategy from './passwordStrategy.js'
|
|
import JwtStrategy from './jwtStrategy.js'
|
|
|
|
passport.use(PasswordStrategy)
|
|
passport.use(JwtStrategy)
|
|
|
|
passport.serializeUser((user, done) => {
|
|
process.nextTick(() => {
|
|
done(null, {
|
|
_id: user._id,
|
|
username: user.username,
|
|
email: user.email,
|
|
})
|
|
})
|
|
})
|
|
|
|
passport.deserializeUser((user, done) => {
|
|
process.nextTick(() => {
|
|
done(null, user)
|
|
})
|
|
})
|