@@ -40,6 +40,7 @@ export class AuthService {
4040 decoded = this . jwtService . verify ( refreshToken , {
4141 secret : process . env . JWT_REFRESH_SECRET || 'default-refresh-secret' ,
4242 } ) ;
43+ } catch {
4344 } catch ( _e ) {
4445 throw new UnauthorizedException ( 'Invalid or expired refresh token' ) ;
4546 }
@@ -109,21 +110,23 @@ export class AuthService {
109110 const payload = { sub : user . id , email : user . email , role : user . role } ;
110111 const refreshJti = uuidv4 ( ) ;
111112
112- const [ accessToken , refreshToken ] = await Promise . all ( [
113- this . jwtService . signAsync ( payload as any , {
113+ const accessToken = await this . jwtService . signAsync (
114+ payload as any ,
115+ {
114116 secret : process . env . JWT_SECRET || 'default-jwt-secret' ,
115117 expiresIn : ( process . env . JWT_EXPIRES_IN || '15m' ) as any ,
116- } as any ) ,
118+ } as any ,
117119 } ) ,
118- this . jwtService . signAsync (
119- { ...payload , jti : refreshJti } as any ,
120- {
121- secret : process . env . JWT_REFRESH_SECRET || 'default-refresh-secret' ,
122- expiresIn : ( process . env . JWT_REFRESH_EXPIRES_IN || '7d' ) as any ,
123- } as any ,
120+ ) ;
121+
122+ const refreshToken = await this . jwtService . signAsync (
123+ { ...payload , jti : refreshJti } as any ,
124+ {
125+ secret : process . env . JWT_REFRESH_SECRET || 'default-refresh-secret' ,
126+ expiresIn : ( process . env . JWT_REFRESH_EXPIRES_IN || '7d' ) as any ,
127+ } as any ,
124128 } ,
125- ) ,
126- ] ) ;
129+ ) ;
127130
128131 return {
129132 accessToken,
0 commit comments