You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 기존 파일 129번줄부터privategetUserEmailFromGoogleUser(request: Request): string {const{ user }=requestasany// 기존 Request 구조에 email 이 없어서 any 로 받아야합니다.returnuser.email}privateasyncgetUserFromGoogleUser(request: Request): Promise<User>{const userName =this.getUserEmailFromGoogleUser(request)constuserFound: User=awaitthis.userRepository.findOne({where: {userName: userName,},})if(userFound===undefined||userFound===null){thrownewUnauthorizedException('invalid token')}returnuserFound}
// 변경 후privategetUserEmailFromGoogleUser(request: Request): string {const{ user }=requestasany// 기존 Request 구조에 email 이 없어서 any 로 받아야합니다.returnuser.email}privateasyncgetUserFromGoogleUser(request: Request): Promise<User>{const userName =this.getUserEmailFromGoogleUser(request)constuserFound: User=awaitthis.userRepository.findOne({where: {userName: userName,},})if(userFound===undefined||userFound===null){returnnull// 이부분 수정}returnuserFound}
// 변경 전 202번줄asyncrotateTokens(request,body: any): Promise<TokenDto>{constaccessToken: string=this.getAccessTokenFromRequest(request)constrefreshToken: string=body.refreshTokenletuserId: numberletexp: number// check token is validtry{constaccessTokenPayload=this.jwtService.verify(accessToken,{ignoreExpiration: true,secret: this.configService.get('JWT_SECRET'),})constrefreshTokenPayload=this.jwtService.verify(refreshToken,{secret: this.configService.get('JWT_SECRET'),})userId=accessTokenPayload.userIdexp=refreshTokenPayload.exp}catch(err){thrownewUnauthorizedException('token verify failed')}awaitthis.checkValidTokenInSession(userId,accessToken,refreshToken)// set new tokenconstnewAccessToken: string=this.getNewAccessToken(userId)constnewRefreshToken: string=this.rotateToken(refreshToken,exp,userId)// update session and send itawaitthis.updateSession(userId,newAccessToken,newRefreshToken)return{accessToken: newAccessToken,refreshToken: newRefreshToken,}}}
// 변경 후 asyncrotateTokens(request,body: any): Promise<TokenDto>{constaccessToken: string=body.accessToken// 이부분 수정constrefreshToken: string=body.refreshTokenletuserId: numberletexp: number// check token is validtry{constaccessTokenPayload=this.jwtService.verify(accessToken,{ignoreExpiration: true,secret: this.configService.get('JWT_SECRET'),})constrefreshTokenPayload=this.jwtService.verify(refreshToken,{secret: this.configService.get('JWT_SECRET'),})userId=accessTokenPayload.userIdexp=refreshTokenPayload.exp}catch(err){thrownewUnauthorizedException('token verify failed')}awaitthis.checkValidTokenInSession(userId,accessToken,refreshToken)// set new tokenconstnewAccessToken: string=this.getNewAccessToken(userId)constnewRefreshToken: string=this.rotateToken(refreshToken,exp,userId)// update session and send itawaitthis.updateSession(userId,newAccessToken,newRefreshToken)return{accessToken: newAccessToken,refreshToken: newRefreshToken,}}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: