This commit is contained in:
Bastian Wagner
2024-08-25 19:56:41 +02:00
parent 095f33e16f
commit 1f853c0f0c
2 changed files with 9 additions and 4 deletions

View File

@@ -14,6 +14,7 @@ import {
} from 'src/model/auth-code.entity';
import { LoggerModule } from 'src/core/logger.module';
import { SessionKey, SessionKeyRepository } from 'src/model/session-key.entity';
import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({
providers: [
@@ -26,9 +27,13 @@ import { SessionKey, SessionKeyRepository } from 'src/model/session-key.entity';
],
controllers: [AuthController],
imports: [
JwtModule.register({
secret: 'SECRET_KEY', // Ändere dies zu einer Umgebungsvariablen in einer realen Anwendung
signOptions: { expiresIn: '15m' },
JwtModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
secret: config.get('JWT_SECRET'),
signOptions: { expiresIn: config.get('JWT_EXPIRES_IN') },
}),
}),
NestjsFormDataModule,
TypeOrmModule.forFeature([

View File

@@ -150,7 +150,7 @@ export class UsersService {
throw new HttpException('Invalid token', 401);
}
this.tokenRepo.removeCode(token);
// this.tokenRepo.removeCode(token);
const access_token = this.createAccessToken(user);
const refresh_token = this.createRefreshToken(user);