File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ export class AuthModule {
5454 DiscordStrategy ,
5555 MagicLinkEmailStrategy ,
5656 JwtStrategy ,
57+ {
58+ inject : [ ConfigService ] ,
59+ provide : 'COOKIE_EXPIRES_IN' ,
60+ useFactory : ( configService : ConfigService ) =>
61+ configService . getOrThrow < string > ( 'COOKIE_EXPIRES_IN' ) ,
62+ } ,
5763 {
5864 provide : 'SERVER_URL' ,
5965 inject : [ ConfigService ] ,
Original file line number Diff line number Diff line change 1- import {
2- HttpException ,
3- HttpStatus ,
4- Inject ,
5- Injectable ,
6- Logger ,
7- } from '@nestjs/common' ;
1+ import { Inject , Injectable , Logger } from '@nestjs/common' ;
82import { JwtService } from '@nestjs/jwt' ;
93import { CreateUser } from '@shared/validation/user/dto/CreateUser.dto' ;
10- import { NewEmailUserDto } from '@shared/validation/user/dto/NewEmailUser.dto' ;
114import axios from 'axios' ;
125import type { Request , Response } from 'express' ;
136
@@ -28,6 +21,8 @@ export class AuthService {
2821 private readonly userService : UserService ,
2922 @Inject ( JwtService )
3023 private readonly jwtService : JwtService ,
24+ @Inject ( 'COOKIE_EXPIRES_IN' )
25+ private readonly COOKIE_EXPIRES_IN : string ,
3126 @Inject ( 'FRONTEND_URL' )
3227 private readonly FRONTEND_URL : string ,
3328
@@ -235,7 +230,7 @@ export class AuthService {
235230
236231 const frontEndURL = this . FRONTEND_URL ;
237232 const domain = this . APP_DOMAIN ;
238- const maxAge = 1000 * 60 * 60 * 24 * 365 ;
233+ const maxAge = parseInt ( this . COOKIE_EXPIRES_IN ) ;
239234
240235 res . cookie ( 'token' , token . access_token , {
241236 domain : domain ,
You can’t perform that action at this time.
0 commit comments