Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#61] refreshToken 보내면 새로운 token 들 반환 #62

Merged
merged 12 commits into from
Apr 16, 2024

Conversation

namewhat99
Copy link
Contributor

이슈

고민한 내용

  • JWT 토큰에 expiresIn 시간 설정
  • 만료된 refreshToken 을 보내면 TokenExpiredError 가 나왔는데 이를 그대로 보내면 500 에러가 뜬다
  • TokenExpiredError 를 Unauthorized 로 바꿔서 401 을 던지게 함

@namewhat99 namewhat99 requested a review from koomin1227 April 14, 2024 07:27
controllers: [LoginController],
providers: [LoginService, JwtStrategy],
})
export class LoginModule {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth module에 합치는게 더 낫지 않을까 생각됩니다. 중복되는 코드도 많고 그래서요

});
} catch (e) {
if (e instanceof TokenExpiredError) {
throw new UnauthorizedException();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에러 핸들링이 잘 되어네요!

@@ -34,4 +34,9 @@ export class AuthController {
) {
return await this.authService.checkSejongStudent(body, userId);
}

@Post('refresh')
public refreshTokens(@Body('refreshToken') refreshToken: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 하면 refresh token으로 숫자가 오면 어떻게 되나요? 400이 나오나요 500이 나오나요?

@koomin1227 koomin1227 merged commit 52d4625 into develop Apr 16, 2024
1 check passed
@koomin1227 koomin1227 deleted the feature/jwtRefresh-#61 branch April 17, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants