[Feat] #198 Apple Login 구현 + AuthInterceptor 적용 #201
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.
📟 연결된 이슈
closed #198
👷 작업한 내용
⌨️ 주요 코드 설명
AuthManager/// 로그인 여부 체크 func checkLogin() { do { self.accessToken = try KeychainManager.read(.accessToken) self.refreshToken = try KeychainManager.read(.refreshToken) authStatus = .loggedIn } catch { authStatus = .loggedOut print(error.localizedDescription) } } /// AppleLogin API func loginWithApple(_ idToken: String, deviceId: String) async { do { let appleLoginReqDto = AppleLoginRequestDTO(idToken: idToken, deviceId: deviceId) let response: AppleLoginResponseDTO = try await provider.async.request(.appleLogin(appleLoginReqDto: appleLoginReqDto)) try KeychainManager.create(.accessToken, response.accessToken) try KeychainManager.create(.refreshToken, response.refreshToken) self.accessToken = response.accessToken self.refreshToken = response.refreshToken authStatus = .loggedIn } catch { print(error.localizedDescription) } } /// 로그아웃 & 토큰 제거 func logout() { do { try KeychainManager.delete(.accessToken) try KeychainManager.delete(.refreshToken) authStatus = .loggedOut } catch { print(error.localizedDescription) } } /// 토큰 재발급시 토큰 저장 func reissueToken(accessToken: String, refreshToken: String) { do { try KeychainManager.create(.accessToken, accessToken) try KeychainManager.create(.refreshToken, refreshToken) self.accessToken = accessToken self.refreshToken = refreshToken } catch { print(error.localizedDescription) } }AuthInterceptor사용 방법
Provider 설정에 AuthInterceptor.shared 추가
📸 스크린샷