Error: secretOrPrivateKey must have a value using JWT Authentication

Viewed 39

I'm getting this error "ERROR [ExceptionsHandler] secretOrPrivateKey must have a value" whenever I run my login method which then calls the following constructor:

@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
  constructor(private readonly usersService: UsersService) {
    super({
      jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
      ignoreExpiration: false,
      secretOrKey: `${process.env.JWT_SECRET_KEY}`,
    });
  }
}
0 Answers
Related