Skip to content

Conversation

@gdaegeun539
Copy link
Member

@gdaegeun539 gdaegeun539 commented Nov 2, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines

What kind of change does this PR introduce?

Select your one and delete others

  • Add feature
  • Refactoring

What is the current behavior?

You can also link to an open issue here

What is the new behavior (if this is a feature change)?

  • 카카오 로그인 SDK를 추가합니다.
  • ActivityContext를 요구하지 않는 카카오 로그인 관련 기능을 DataSource에 격리해 구현합니다.
  • ActivityContext를 요구하는 카카오 로그인 기능을 LoginScreen에 격리해 구현합니다.
  • AuthRepository의 기능을 아래와 같이 변경합니다.
    • 로그인에 대한 자체 백엔드 서버 로그인 기능 연동
    • 로그아웃에 대한 자체 백엔드 서버 로그아웃 및 소셜 계정 로그아웃 기능 연동
    • 회원탈퇴에 대한 자체 백엔드 서버 탈퇴 및 소셜 계정 탈퇴 기능 연동
  • OkHttp 로거를 추가합니다.
  • 인증 관련 OkHttp 인터셉터, 토큰 재발급 관련 OkHttp Authienticator를 추가합니다.
  • 몇몇 Hilt DI 설정을 추가합니다.
  • ... 이외에도 추가된 변경사항이 많습니다. 빠르게 작업을 완료하지 못해 죄송합니다.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Yes

  • 'What is the new behavior' 섹션에 서술된 것 처럼 라이브러리 추가 및 초기 설정이 많습니다.

  • Hilt를 사용하기 위한 기본 설정 및 스코프를 설정합니다.

  • SCRUM-243 init: kakao login sdk set #12 과 같이 레포지토리와 DataSource는 @Singleton 스코프를 유지합니다.

  • 몇 개의 함수가 detekt의 반환 개수 기준을 통과하지 못해 CI가 실패하는데, 이 기준은 한 번 논의했으면 합니다.

Other information:

PR 양이 많은데, 양해 부탁드립니다. 억지로 작업량을 줄인 #12 처럼 일부분만을 올리는 것 보다 완전히 작동하는 코드를 올리는 게 맞다고 보아, 외부 SDK 설정-HTTP 통신-코드 연동을 위한 Hilt 설정을 모두 진행한 PR로 다시 올립니다.

지금은 소셜 토큰으로 로그인을 진행할 때 우리 서버에 계정이 없어 02000 에러를 받는 상황까지만 구현됐고, 이후 사항은 회원가입 온보딩에 연동해야 해요.

혹시 예외처리를 완전히 진행하는 걸 원하시거나, 다이얼로그까지 띄우는 것을 원하신다면 말씀해 주세요. 이 PR에 기능이 이미 많아서 통합하는 건 어려울 거 같은데, 진행을 원하시면 다른 티켓을 끊어서 작업할게요.

- add kakao sdk repository, add login sdk
- add kakao sdk r8 rules
- add application class and sdk init code
- set kakao api key loader
- add login sdk redirection activity setting
- add login, logout, unlink
- own feelin server jwt token model
- common oauth token model
  - to unify support kakao, google oauth token
Add androidx.datastore.preferences library to enable secure
token storage with Flow-based reactive data access.

- Add datastore version 1.1.1 to libs.versions.toml
- Add datastore-preferences dependency to app module
Add fromString() companion method to convert stored string
values back to OAuthProvider enum for DataStore retrieval.

- Support case-insensitive string matching
- Return null for invalid provider names
Implement DataStore-based local data source to persist
authentication tokens and OAuth information.

Storage strategy:
- Backend JWT tokens (access, refresh, userId)
- OAuth provider and tokens
- Flow-based reactive data access
- Singleton pattern for app-wide consistency

Multi-module ready: Can be moved to :core:data module
Implement singleton manager to handle authentication state
and token management across the entire app lifecycle.

Responsibilities:
- Memory caching via StateFlow for reactive UI
- Delegate persistence to AuthLocalDataSource
- Synchronize in-memory state with storage
- Manage both Backend JWT and OAuth tokens

Features:
- Auto-load tokens on app start
- Reactive login state (isLoggedIn)
- OAuth provider tracking
- Token update and clear operations

Multi-module ready: Can be moved to :core:data module
Implement OkHttp interceptor to automatically attach
JWT access token to all API requests.

Features:
- Read token from AuthManager StateFlow
- Add Authorization: Bearer header
- Skip if no token available
- Singleton pattern for OkHttp client

Includes TokenAuthenticator stub for future 401 handling
and automatic token refresh implementation.

Multi-module ready: Can be moved to :core:network module
Update AuthRepository to use AuthManager for centralized
token management and reactive login state.

Changes:
- Remove EncryptedSharedPreferences dependency
- Integrate AuthManager for token persistence
- Expose isLoggedIn and userId as StateFlow
- Store OAuth provider and tokens on login
- Clear all tokens on logout via AuthManager
- Update AuthToken model to use Long userId

Backend API compatibility:
- Match response structure with userId as Long
- Temporary dummy token until backend integration

TODO: Implement actual backend API calls for login/logout
Configure Hilt DI module for authentication components
to ensure singleton instances across the app.

Provides:
- AuthLocalDataSource @singleton
- AuthManager @singleton

Dependencies are automatically injected via constructor
injection pattern following Hilt best practices.

Multi-module ready: Can be moved to :core:data module
- serializer to kotlinx.serialization
- include DeviceId Header
- remove duplicate provides to prevent CyclicDependency
  - AuthDataLocalSource
  - AuthManager
- add annotation auth sdk source to prevent MissingBinding
  - KakaoAuthDataSource
  - GoogleAuthDataSource
- 카카오 로그인 SDK와 Jetpack Credentials에서 activity가 필요한 부분을 View에서 직접 연동하도록 합니다.
@gdaegeun539 gdaegeun539 self-assigned this Nov 2, 2025
@gdaegeun539 gdaegeun539 added feat 새로운 기능 refactor 코드 리팩토링 labels Nov 2, 2025
@gdaegeun539 gdaegeun539 changed the title SCRUM-243 SCRUM-244 SCRUM-245 feat: kakao login and server login integration SCRUM-243 SCRUM-244 SCRUM-245 feature: kakao login and server login integration Nov 11, 2025
@gdaegeun539
Copy link
Member Author

서버 터져서 결과값도 못 보는데 서버 다시 열릴때까지 드래프트 상태로 둘게요

@gdaegeun539 gdaegeun539 marked this pull request as draft November 21, 2025 14:13
@gdaegeun539
Copy link
Member Author

gdaegeun539 commented Dec 1, 2025

서버 이관이 완료됐다 하셔서 PR을 다시 열게요.

@gdaegeun539 gdaegeun539 marked this pull request as ready for review December 1, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 새로운 기능 refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant