chore(deps): upgrade NestJS and related dependencies to version 11.x
fix(auth): ensure JWT_SECRET is set in JwtStrategy constructor
This commit is contained in:
@@ -7,10 +7,15 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
private readonly logger = new Logger(JwtStrategy.name);
|
||||
|
||||
constructor() {
|
||||
const jwtSecret = process.env.JWT_SECRET;
|
||||
if (!jwtSecret) {
|
||||
throw new Error('JWT_SECRET is not set');
|
||||
}
|
||||
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: process.env.JWT_SECRET,
|
||||
secretOrKey: jwtSecret,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user