Skip to content

Commit

Permalink
chore/#154 오타수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hooni0918 committed Jul 11, 2024
1 parent 2b04452 commit 95343c5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions KkuMulKum/Source/Onboarding/Login/VIewModel/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 95343c5

Please sign in to comment.