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 {
54
54
DiscordStrategy ,
55
55
MagicLinkEmailStrategy ,
56
56
JwtStrategy ,
57
+ {
58
+ inject : [ ConfigService ] ,
59
+ provide : 'COOKIE_EXPIRES_IN' ,
60
+ useFactory : ( configService : ConfigService ) =>
61
+ configService . getOrThrow < string > ( 'COOKIE_EXPIRES_IN' ) ,
62
+ } ,
57
63
{
58
64
provide : 'SERVER_URL' ,
59
65
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' ;
8
2
import { JwtService } from '@nestjs/jwt' ;
9
3
import { CreateUser } from '@shared/validation/user/dto/CreateUser.dto' ;
10
- import { NewEmailUserDto } from '@shared/validation/user/dto/NewEmailUser.dto' ;
11
4
import axios from 'axios' ;
12
5
import type { Request , Response } from 'express' ;
13
6
@@ -28,6 +21,8 @@ export class AuthService {
28
21
private readonly userService : UserService ,
29
22
@Inject ( JwtService )
30
23
private readonly jwtService : JwtService ,
24
+ @Inject ( 'COOKIE_EXPIRES_IN' )
25
+ private readonly COOKIE_EXPIRES_IN : string ,
31
26
@Inject ( 'FRONTEND_URL' )
32
27
private readonly FRONTEND_URL : string ,
33
28
@@ -235,7 +230,7 @@ export class AuthService {
235
230
236
231
const frontEndURL = this . FRONTEND_URL ;
237
232
const domain = this . APP_DOMAIN ;
238
- const maxAge = 1000 * 60 * 60 * 24 * 365 ;
233
+ const maxAge = parseInt ( this . COOKIE_EXPIRES_IN ) ;
239
234
240
235
res . cookie ( 'token' , token . access_token , {
241
236
domain : domain ,
You can’t perform that action at this time.
0 commit comments