-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: 응답 코드가 401이면 로그인 화면으로 이동하는 기능 구현 #831
Merged
tmdgh1592
merged 3 commits into
android-main
from
Feature/#830-AccessToken_만료시_로그인_화면으로_이동하는_기능
Nov 8, 2023
The head ref may contain hidden characters: "Feature/#830-AccessToken_\uB9CC\uB8CC\uC2DC_\uB85C\uADF8\uC778_\uD654\uBA74\uC73C\uB85C_\uC774\uB3D9\uD558\uB294_\uAE30\uB2A5"
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 27 additions & 5 deletions
32
android/2023-emmsale/app/src/main/java/com/emmsale/data/common/retrofit/AuthInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
401 코드의 의미는 정확히 access token이 만료되었을 때를 의미하는 것이 아니라 비인증을 나타낼 때 쓰이는 것이므로 401을 적절한 이름을 사용하여 상수화하면 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
비인증인 상황은 토큰이 만료된 경우, 유효하지 않은 경우가 있겠군요.
조금 더 추상적으로
isAccessTokenInvalid()
로 작성하면 두 의미를 모두 포함할 수 있겠네요.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실 토큰이 아니라 쿠키 혹은 세션으로 인증하는 방식이라면 비인증이 토큰이 유효하지 않은 경우와 일치하지 않는다고 생각합니다. 하지만 저희 앱은 토큰만 사용하기로 했으니
isAccessTokenInvalid()
가 괜찮을까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
커디 앱에서는 JWT를 사용하고 있는데, 세션이라는 개념이 필요할까요..?
JWT를 사용한다면 401이 되는 상황은 크게 위에 말씀드린 두 가지 경우일 것이라고 생각이 드네요~
세션을 사용하지 않는데 메서드명에 Session까지 고려한 이름을 사용할 필요는 없다고 생각합니다.