feat: add jwt
This commit is contained in:
@@ -4,9 +4,26 @@ import { AuthService } from './providers/auth.service';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { OtpModule } from '../otp/otp.module';
|
||||
import { HashingModule } from '@/common/modules/hashing/hashing.module';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Module({
|
||||
imports: [UsersModule, OtpModule, HashingModule],
|
||||
imports: [
|
||||
UsersModule,
|
||||
OtpModule,
|
||||
HashingModule,
|
||||
JwtModule.registerAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
secret: configService.get<string>('jwt.access.secret'),
|
||||
signOptions: {
|
||||
expiresIn: configService.get<number>('jwt.access.expiresIn'),
|
||||
issuer: configService.get<string>('jwt.issuer'),
|
||||
audience: configService.get<string>('jwt.audience'),
|
||||
},
|
||||
}),
|
||||
}),
|
||||
],
|
||||
controllers: [AuthController],
|
||||
providers: [AuthService],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user