auth
This commit is contained in:
@@ -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([
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user