As per NestJS authentication tutorial I copy pasted the JwtStrategy
class but that class throws an error at build time
Class code is
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor(private readonly userRepo: UserRepository) {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKey: 'secretKey'
});
}
}
And with target=es5 in tsconfig.json file the error I get
Now if I change the target to es6 error goes away but then typeorm many to many relationship start throwing an error
TypeORM class User got tokens and Token class got user and it throws the error below
I have created the repository to reproduce the error at this link
run following command to see the error
ng s --project=api
You are mixing nest v5 and nest v6 although different major versions are not guaranteed to interoperate properly, e.g.:
"@nestjs/core": "5.5.0",
"@nestjs/jwt": "^6.0.0",
Please update all your @nestjs
dependencies to version 6 following the migration guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With