mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
25 lines
542 B
JavaScript
25 lines
542 B
JavaScript
import passport from 'passport'
|
|
import passwordStrategy from './passwordStrategy.js'
|
|
import jwtStrategy from './jwtStrategy.js'
|
|
import googleStrategy from './googleStrategy.js'
|
|
|
|
passport.use(passwordStrategy)
|
|
passport.use(jwtStrategy)
|
|
passport.use(googleStrategy)
|
|
|
|
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)
|
|
})
|
|
})
|