From dbe7e7ef425ebece27aff1852d4743be73d87598 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 3 Nov 2022 01:09:43 +0100 Subject: [PATCH] initialize the jwt module --- src/auth/auth.module.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts index fe77c80..97e394a 100644 --- a/src/auth/auth.module.ts +++ b/src/auth/auth.module.ts @@ -1,9 +1,22 @@ import { HttpModule } from '@nestjs/axios'; import { Module } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { JwtModule } from '@nestjs/jwt'; import { AuthController } from './auth.controller'; +import { JwtStrategy } from './strategies/jwt.strategy'; @Module({ - imports: [HttpModule], + imports: [ + HttpModule, + JwtModule.registerAsync({ + inject: [ConfigService], + useFactory: async (config: ConfigService) => ({ + secret: config.get('server.jwt-secret'), + signOptions: { expiresIn: '1h' }, + }), + }), + ], + providers: [JwtStrategy], controllers: [AuthController], }) export class AuthModule {}