From 95343c5100fb89b63fe084bd4858e70ce993d260 Mon Sep 17 00:00:00 2001 From: hooni Date: Thu, 11 Jul 2024 23:16:09 +0900 Subject: [PATCH] =?UTF-8?q?chore/#154=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Onboarding/Login/VIewModel/LoginViewModel.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/KkuMulKum/Source/Onboarding/Login/VIewModel/LoginViewModel.swift b/KkuMulKum/Source/Onboarding/Login/VIewModel/LoginViewModel.swift index 53127bf6..d7868a29 100644 --- a/KkuMulKum/Source/Onboarding/Login/VIewModel/LoginViewModel.swift +++ b/KkuMulKum/Source/Onboarding/Login/VIewModel/LoginViewModel.swift @@ -70,12 +70,19 @@ class LoginViewModel: NSObject { extension LoginViewModel: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding { func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) { - guard let credential = authorization.credential as? ASAuthorizationAppleIDCredential else { + guard let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential else { print("Authorization failed: Credential is not of type ASAuthorizationAppleIDCredential") return } - let userName = credential.fullName?.givenName ?? "Apple user" + + let userName = appleIDCredential.fullName?.givenName ?? "Apple user" loginState.value = .loggedIn(userInfo: "Apple user: \(userName)") + + // 액세스 토큰 출력 + if let identityToken = appleIDCredential.identityToken, + let tokenString = String(data: identityToken, encoding: .utf8) { + print("Apple Login Access Token: \(tokenString)") + } } func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {