import { Module } from '@nestjs/common';
import { userService } from 'src/users/users.service';
import { JwtModule } from '@nestjs/jwt';
import { authControler } from './auth.controler';
import { JwtService } from '@nestjs/jwt';
import { authService } from './auth.service';
import { UsersModule } from 'src/users/users.module';
import { PassportModule } from '@nestjs/passport';
import { TypeOrmModule } from '@nestjs/typeorm';
import { users } from 'src/users/user.entity';
import { JwtStrategy } from './stratiges/jwt.stratige';
import { LocalStrategy } from './stratiges/local.stratige';
@Module({
imports: [
TypeOrmModule.forFeature([users]),
UsersModule,
PassportModule,
JwtModule.register({
secret: 'this should be env var',
signOptions: { expiresIn: '60s' },
}),
],
controllers: [authControler],
providers: [JwtService, authService, userService, JwtStrategy, LocalStrategy],
})
export class authModule {}
i get this error secretOrPrivateKey must have a value i tryed to supply it also but with the same error
the only answer is provided that its because env not read properly and i dont use any i just use a string
i get this error secretOrPrivateKey must have a value i tryed to supply it also but with the same error
the only answer is provided that its because env not read properly and i dont use any i just use a string
Remove the JwtService
from the providers
. It's existence is already guaranteed because you imported the JwtModule
. By adding a second one, you are overriding the configured one from the module.