mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
15 lines
416 B
TypeScript
15 lines
416 B
TypeScript
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'
|
|
import type { VerifyCallback } from 'passport-jwt'
|
|
import config from '../config.js'
|
|
|
|
const jwtOptions = {
|
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
secretOrKey: config.secret,
|
|
}
|
|
|
|
function verifyJwt(jwtPayload: any, done: VerifyCallback) {
|
|
return done(null, jwtPayload)
|
|
}
|
|
|
|
export default new JwtStrategy(jwtOptions, verifyJwt)
|