Skip to content

Commit 8250082

Browse files
committed
fix: access token fix
1 parent 6303110 commit 8250082

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/api/auth/auth.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import { AuthController } from './auth.controller'
55
import { JwtModule } from '@nestjs/jwt'
66
import { ConfigService } from '@nestjs/config'
77
import { JwtStrategy, RefreshJwtStrategy } from './strategies/jwt.strategy'
8+
import { JWT_VALIDITIES } from '@src/commons/constants'
89

910
@Module({
1011
imports: [
1112
JwtModule.registerAsync({
1213
useFactory: async (config: ConfigService) => {
1314
return {
14-
secret: config.get<string>('JWT_ACCESS_TOKEN_SECRET'),
15+
secret: config.getOrThrow<string>('JWT_ACCESS_TOKEN_SECRET'),
1516
signOptions: {
16-
expiresIn: config.get<string>('JWT_ACCESS_TOKEN_VALIDITY'),
17+
expiresIn: JWT_VALIDITIES.accessToken,
1718
},
1819
}
1920
},

src/commons/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { access } from 'fs';
12
import { StringValue } from 'ms'
23

34
export const SLUG_REGEX = /^[a-zA-Z0-9\-\_]{1,30}$/
@@ -9,6 +10,7 @@ export const COOKIES_NAMES = {
910
} as const
1011

1112
export const JWT_VALIDITIES = {
13+
accessToken: '15 m',
1214
refreshToken: '30 d',
1315
forgotPassword: '60 m',
1416
emailVerification: '1 d'

0 commit comments

Comments
 (0)