feat: add jwt

This commit is contained in:
2026-02-22 17:16:57 +03:30
parent 20c89c472c
commit 72a001a150
8 changed files with 183 additions and 9 deletions
+18 -1
View File
@@ -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],
})