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

[FIX] 로그인 관련 예외 처리 추가 #104

Merged
merged 5 commits into from
Mar 5, 2024
Merged

[FIX] 로그인 관련 예외 처리 추가 #104

merged 5 commits into from
Mar 5, 2024

Conversation

easyhooon
Copy link
Collaborator

@easyhooon easyhooon commented Mar 5, 2024

  • intro 화면에서 카카오 측에서 accessToken의 유효성을 검사하기 이전에 accessToken을 앱에서 저장하고 있는지 검사하는 로직 추가

  • 로그인을 수행할때, 카카오 로그인 진행 후(accessToken 발급), 서버 로그인 진행시, timeout 에러가 발생하여 제대로 로그인이 진행되지 않는 경우, 앱에 저장된 토큰(accessToken, uuid)를 모두 제거

  • 다시 앱에 진입할 경우, 카카오측에선 accessToken을 발급했고, 이 토큰이 유효하기 때문에 자동 로그인이 되어 홈화면으로 넘어가는 문제 발생 -> 이때 유저정보 api 와 같은 헤더에 accessToken을 필요로 하는 api를 호출하게 될 경우, 앱내에 저장된 accessToken이 존재하지 않기 때문에 문제 발생

  • 따라서 앱내에 accessToken 이 정상적으로 저장되어있고, 이 토큰이 유효할때에만 자동로그인이 되도록 로직 변경

한계: 토큰의 유효성을 검사할때는 앱내에 저장된 토큰을 통해 하는 것이 아니라, AuthApiClient.instance.hasToken, AuthApiClient.instance.accessTokenInfo 와 같은 함수를 통해 진행하는 것이기에, SSOT 원칙의 위배되는감이 없지 않아 있음...
그리고 이렇게 클라에서 토큰에 대한 유효성을 검사해도 현재 유저정보 API(/me)를 호출할 때, 문제가 서버관련 에러가 발생함(클라에선 500, 서버에러는 401) 결국에는 서버에서도 카카오측에 통신을 할때 토큰의 유효성 검사를 하는 것을 알 수 있음.

해결: 토큰의 유효성 검사 자체를 서버에 위임하는게 SSOT 원칙에 들어맞으므로 그게 더 적절한 방법일 것 같음

@easyhooon easyhooon added the bug Something isn't working label Mar 5, 2024
@easyhooon easyhooon requested a review from josushell March 5, 2024 04:44
@easyhooon easyhooon self-assigned this Mar 5, 2024
같은 intent 블럭 내에서 reduce, postSideEffect 를 호출하여 동시성을 보장
intro 모듈 내에 proguard-rules.pro 추가
로그인 API Request data class 관련 에러 해결
리젝을 먹어서 앱 번들을 업데이트하여 올렷음..
Copy link
Member

@josushell josushell left a comment

Choose a reason for hiding this comment

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

굿입니다

@easyhooon easyhooon merged commit 711d869 into develop Mar 5, 2024
1 check passed
@easyhooon easyhooon deleted the fix/login branch March 5, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants