iOS 카카오톡 로그인 실패

문의 시, 사용하시는 SDK 버전 정보와 디벨로퍼스 앱ID를 알려주세요.

SDK 버전 : 2.15.0 / 디벨로퍼스 앱ID : 874270


안녕하세요 iOS SDK 카카오톡 로그인 사용중입니다

LTE에서는 카카오톡 로그인이 정상적으로 동작하는데 wifi 사용시 로그인이 실패되고 있습니다.

아래는 로그입니다

**"SnsLoginViewController viewWillAppear"**

**"Button Clicked"**

**2024-01-08 04:34:56487 [💬][Properties.swift 33:21] -> load-crypted : {length = 288, bytes = 0x81b3fb70 7ace2867 6e0f184c 4bcab727 ... b36ef388 6fc390e7 }**

**2024-01-08 04:34:56500 [💬][Properties.swift 35:21] -> load-plain : {length = 288, bytes = 0x7bc6c22e fad4591d a427f0f8 9e2fd835 ... 318cd5a3 003c1047 }**

**2024-01-08 04:34:56501 [💬][MigrateManager.swift 21:17] -> ============================================================================================================**

**2024-01-08 04:34:56501 [💬][MigrateManager.swift 22:17] -> check migration...**

**2024-01-08 04:34:56502 [💬][MigrateManager.swift 24:21] -> pass migration...**

**2024-01-08 04:34:56502 [💬][MigrateManager.swift 25:21] -> used sdk version:2.15.0**

**2024-01-08 04:34:56508 [💬][AuthApiCommon.swift 44:17] -> >>>> [KakaoSDKCommon.SessionType.RxAuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Api: Alamofire.Session, KakaoSDKCommon.SessionType.AuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Auth: Alamofire.Session]**

**2024-01-08 04:34:56509 [💬][AuthController.swift 378:21] -> code_verifier: gM4rKjBRyEvkjVBJpXZcBqYVyu4hjBiE7JuUgidZOtVFxKDKh0vFmH/mq88IcJQNd1jLAmnL+/pmz2FOWhXxlQ**

**2024-01-08 04:34:56509 [💬][AuthController.swift 381:25] -> code_challenge: u29uAw0FDLiu-uep4eJ2j-J72kmF2D-kHFUl-1JrUP4**

**2024-01-08 04:34:56573 [💬][AuthController.swift 139:25] -> 카카오톡 실행: kakaokompassauth://authorize?response_type=code&redirect_uri=kakaob0736cf7617005e4973342e6e3c221cd://oauth&client_id=b0736cf7617005e4973342e6e3c221cd&headers=%7B%22KA%22:%22sdk%5C/2.15.0%20sdk_type%5C/swift%20os%5C/ios-16.6%20lang%5C/ko-KR%20res%5C/375x812%20device%5C/iPhone%20origin%5C/com.infovine.MoneyMoa%20app_ver%5C/02.00.02%22%7D&params=%7B%22code_challenge%22:%22u29uAw0FDLiu-uep4eJ2j-J72kmF2D-kHFUl-1JrUP4%22,%22code_challenge_method%22:%22S256%22%7D**

**2024-01-08 16:34:57.342517+0900 EveryMoney[3400:883590] [Common] Snapshot request 0x28089c150 complete with error: <NSError: 0x2808476f0; domain: BSActionErrorDomain; code: 6 (anulled)>**

**2024-01-08 04:34:57436 [💬][Api.swift 127:29] -> ===================================================================================================**

**2024-01-08 04:34:57436 [💬][Api.swift 128:29] -> session:**

**type: Auth**

**2024-01-08 04:34:57439 [ℹ️][Api.swift 129:29] -> request:**

**method: HTTPMethod(rawValue: "POST")**

**url:https://kauth.kakao.com/oauth/token**

**headers:nil**

**parameters: Optional(["client_id": "b0736cf7617005e4973342e6e3c221cd", "code_verifier": "gM4rKjBRyEvkjVBJpXZcBqYVyu4hjBiE7JuUgidZOtVFxKDKh0vFmH/mq88IcJQNd1jLAmnL+/pmz2FOWhXxlQ", "redirect_uri": "kakaob0736cf7617005e4973342e6e3c221cd://oauth", "code": "z3jm6L5knPB1famw018uYLR9Tyy_iEYiqbjSJCuUXDI1V6r5RHJYvigZlA4KKwyoAAABjOf-_KyBPKUF0hG4dQ", "ios_bundle_id": "com.infovine.MoneyMoa", "grant_type": "authorization_code"])**

**2024-01-08 04:34:57440 [ℹ️][Api.swift 130:41] -> response:**

**Optional({**

**"access_token" = "qUaaWuFz57EAvjRCo4Jp1ZFmbFmocw3MknsKKwzUAAABjOf-_wRb9Pmr5eg_ZA";**

**"expires_in" = 43199;**

**"refresh_token" = "fTvMUSbszmMFvckpnZ4JEGsnv-0f4dYWktwKKwzUAAABjOf-_wFb9Pmr5eg_ZA";**

**"refresh_token_expires_in" = 5183999;**

**scope = "profile_image profile_nickname";**

**"token_type" = bearer;**

**})**

**2024-01-08 04:34:57444 [💬][Properties.swift 23:21] -> save-plain : {length = 272, bytes = 0x7b227265 66726573 68546f6b 656e4578 ... 223a3433 3139397d }**

**2024-01-08 04:34:57449 [💬][Properties.swift 25:21] -> save-crypted : {length = 288, bytes = 0x67dba3b2 db1e8dc7 597eebb5 a1a5e13b ... 68ba85df b9c6d13c }**

**"loginWithKakaoTalk() success."**

**2024-01-08 04:34:57652 [💬][Api.swift 127:29] -> ===================================================================================================**

**2024-01-08 04:34:57653 [💬][Api.swift 128:29] -> session:**

**type: AuthApi**

**2024-01-08 04:34:57655 [ℹ️][Api.swift 129:29] -> request:**

**method: HTTPMethod(rawValue: "GET")**

**url:https://kapi.kakao.com/v2/user/me**

**headers:nil**

**parameters: Optional(["secure_resource": true])**

**2024-01-08 04:34:57656 [ℹ️][Api.swift 130:41] -> response:**

**Optional({**

**"connected_at" = "2023-11-17T08:48:32Z";**

**id = 3167303089;**

**"kakao_account" = {**

**"email_needs_agreement" = 1;**

**"has_email" = 1;**

**profile = {**

**"is_default_image" = 1;**

**nickname = Info;**

**"profile_image_url" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_640x640.jpg";**

**"thumbnail_image_url" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_110x110.jpg";**

**};**

**"profile_image_needs_agreement" = 0;**

**"profile_nickname_needs_agreement" = 0;**

**};**

**properties = {**

**nickname = Info;**

**"profile_image" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_640x640.jpg";**

**"thumbnail_image" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_110x110.jpg";**

**};**

**})**

**"사용자에게 추가 동의를 받아야 합니다."**

**2024-01-08 04:34:57731 [💬][Api.swift 127:29] -> ===================================================================================================**

**2024-01-08 04:34:57732 [💬][Api.swift 128:29] -> session:**

**type: Auth**

**2024-01-08 04:34:57733 [ℹ️][Api.swift 129:29] -> request:**

**method: HTTPMethod(rawValue: "POST")**

**url:https://kauth.kakao.com/api/agt**

**headers:nil**

**parameters: Optional(["client_id": "b0736cf7617005e4973342e6e3c221cd", "access_token": "qUaaWuFz57EAvjRCo4Jp1ZFmbFmocw3MknsKKwzUAAABjOf-_wRb9Pmr5eg_ZA"])**

**2024-01-08 04:34:57733 [ℹ️][Api.swift 130:41] -> response:**

**Optional({**

**agt = "ayIYnK20MBnBGlwlYgqKRs3Wo1p-YZXTKaIVbgorDNQAAAGM5_8ANA";**

**})**

**2024-01-08 04:34:57736 [💬][AuthController.swift 466:21] -> code_verifier: AGLb6926Q/SccJCDcdpQHaxjvLr3htRhsutYi8joOeqpcb0day+4e1qw26VjEFB5x8oQ4008cvChFR31yFSn8w**

**2024-01-08 04:34:57737 [💬][AuthController.swift 469:25] -> code_challenge: NPkyPVTLRfxUZa4Jxg3cAQzUIC57UJo6yfdluCOhGPU**

**2024-01-08 04:34:57737 [💬][AuthController.swift 301:21] ->**

**===================================================================================================**

**2024-01-08 04:34:57738 [💬][AuthController.swift 302:21] -> request:**

**url:https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=b0736cf7617005e4973342e6e3c221cd&redirect_uri=kakaob0736cf7617005e4973342e6e3c221cd://oauth&code_challenge=NPkyPVTLRfxUZa4Jxg3cAQzUIC57UJo6yfdluCOhGPU&scope=account_email&code_challenge_method=S256&agt=ayIYnK20MBnBGlwlYgqKRs3Wo1p-YZXTKaIVbgorDNQAAAGM5_8ANA&ka=sdk/2.15.0%20sdk_type/swift%20os/ios-16.6%20lang/ko-KR%20res/375x812%20device/iPhone%20origin/com.infovine.MoneyMoa%20app_ver/02.00.02**

**2024-01-08 04:34:57745 [‼️][AuthController.swift 236:33] -> An error occurred on executing authentication session.**

**reason: related decl 'e' for ASWebAuthenticationSessionErrorCode(_nsError: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=3 "The UIWindowScene for the returned window was not in the foreground active state." UserInfo={NSDebugDescription=The UIWindowScene for the returned window was not in the foreground active state.})**

**2024-01-08 04:34:57746 [💬][AuthController.swift 191:33] -> top vc: SnsLoginViewController**

**2024-01-08 04:34:57747 [💬][AuthController.swift 203:37] -> top vc: SnsLoginViewController**

KakaoSDKCommon.SdkError.ClientFailed(reason: KakaoSDKCommon.ClientFailureReason.Unknown, errorMessage: Optional("An error occurred on executing authentication session."))

로그상에서는 카카오 로그인 요청이 2회 요청되는 것으로 보이는데요
구현하신 코드 확인 부탁드리며, 로그인 기능이 메인스레드에서 동작하는지도 확인 부탁드립니다.

안녕하세요 구현한 소스 입니다.
메인쓰레드에서 동작합니다

@IBAction func kakaoLoginAction(_ sender: Any) {
        Base.sharedInstance.firebaseLog(eventName: "카카오_로그인_진행", parameters: nil)
        DispatchQueue.main.async {
            UIView.animate(withDuration: 0.1) {
                Social.shared.useKakao()
            }
        }
    }


    func useKakao() {
        // 카카오톡 실행 가능 여부 확인
        if (UserApi.isKakaoTalkLoginAvailable()) {
            UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in
                    if let error = error {
                        debugPrint(error)
                        Base.sharedInstance.Output_Alert(title: "알림", message: error.localizedDescription, text: "확인")
                    }
                    else {
                        debugPrint("loginWithKakaoTalk() success.")
                        
                        UserApi.shared.me() { (user, error) in
                            if let error = error {
                                debugPrint(error)
                                Base.sharedInstance.Output_Alert(title: "알림", message: error.localizedDescription, text: "확인")
                            }
                            else {
                                if let user = user {
                                    var scopes = [String]()
                                
                                    
                                    if (user.kakaoAccount?.emailNeedsAgreement == true) { scopes.append("account_email") }
                                    
                                    if (user.kakaoAccount?.profileNicknameNeedsAgreement == true) { scopes.append("profile_nickname") }
                                    
                                    if (user.kakaoAccount?.profileImageNeedsAgreement == true) { scopes.append("profile_image") }
                                    
                                    if scopes.count > 0 {
                                        debugPrint("사용자에게 추가 동의를 받아야 합니다.")
                                        //scope 목록을 전달하여 카카오 로그인 요청
                                        UserApi.shared.loginWithKakaoAccount(scopes: scopes) { (_, error) in
                                            if let error = error {
                                                debugPrint(error)
                                            }
                                            else {
                                                UserApi.shared.me() { (user, error) in
                                                    if let error = error {
                                                        debugPrint(error)
                                                    }
                                                    else {
                                                        
                                                        guard let kakaoEmail = user?.kakaoAccount?.email else { return }
                                                        guard let profile_image  = user?.properties?["profile_image"] else { return }
                                                        guard let nickName  = user?.properties?["nickname"] else { return }
                                                        guard let token = oauthToken?.accessToken else { return }
                                                        guard let profile_image_url  = URL(string: profile_image) else { return }
                                                        
                                                        debugPrint("\(String(describing: kakaoEmail))")
                                                        debugPrint("\(String(describing: profile_image))")
                                                        debugPrint("\(String(describing: nickName))")
                                                        debugPrint("\(String(describing: token))")
                                                        debugPrint("\(String(describing: profile_image_url))")
                                                        
                                                        self.delegate?.result(socialType: snsLoginType.kakaoType, email: kakaoEmail, snsAccessToken: token, name: nickName, profileImg: profile_image_url)
                                                     
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else {
                                        debugPrint("사용자의 추가 동의가 필요하지 않습니다.")
                                        guard let kakaoEmail = user.kakaoAccount?.email else { return }
                                        guard let profile_image  = user.properties?["profile_image"] else { return }
                                        guard let nickName  = user.properties?["nickname"] else { return }
                                        guard let token = oauthToken?.accessToken else { return }
                                        guard let profile_image_url  = URL(string: profile_image) else { return }
                                        
                                        debugPrint("\(String(describing: kakaoEmail))")
                                        debugPrint("\(String(describing: profile_image))")
                                        debugPrint("\(String(describing: nickName))")
                                        debugPrint("\(String(describing: token))")
                                        debugPrint("\(String(describing: profile_image_url))")
                                        
                                        self.delegate?.result(socialType: snsLoginType.kakaoType, email: kakaoEmail, snsAccessToken: token, name: nickName, profileImg: profile_image_url)
                                        
                                    }
                                }
                            }
                        }
                    }
                }
            


        } else {
            Base.sharedInstance.Output_Alert(title: "알림", message: "카카오톡을 설치 후 실행해주세요", text: "확인")
        }
    }

코드만 보았을 때, 메인 스레드에서 동작하지 않아 보이는데요
SnsLoginViewController 관련 애니메이션 코드 제거하시고 확인 부탁드립니다.

메인스레드 및 애니메이션 제거하여도 동일하게 오류 납니다

@IBAction func kakaoLoginAction(_ sender: Any) {
        Base.sharedInstance.firebaseLog(eventName: "카카오_로그인_진행", parameters: nil)
        //2024.01.10 pys - wifi에서 카카오 약관 동의 안나오는 이슈로 수정
        //DispatchQueue.main.async { //
        //    UIView.animate(withDuration: 0.1) {
                Social.shared.useKakao()
        //    }
        //}
    }
    SnsLoginViewController viewWillAppear"
"Button Clicked"
2024-01-17 01:34:37902 [💬][MigrateManager.swift 21:17] -> ============================================================================================================
2024-01-17 01:34:37904 [💬][MigrateManager.swift 22:17] -> check migration... 
2024-01-17 01:34:37905 [💬][MigrateManager.swift 43:17] -> ============================================================================================================
2024-01-17 01:34:37906 [💬][MigrateManager.swift 44:17] -> start migration sdk from v1 to v2.... 
2024-01-17 01:34:37907 [💬][MigrateManager.swift 68:21] ->  first time sdk v2...
2024-01-17 01:34:37910 [💬][MigrateManager.swift 96:17] -> finished migration sdk...
2024-01-17 01:34:37924 [💬][AuthApiCommon.swift 44:17] -> >>>> [KakaoSDKCommon.SessionType.RxAuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Api: Alamofire.Session, KakaoSDKCommon.SessionType.Auth: Alamofire.Session, KakaoSDKCommon.SessionType.AuthApi: Alamofire.Session]
2024-01-17 01:34:37928 [💬][AuthController.swift 378:21] -> code_verifier: GU6jTwQWJKqmJTNNoPrgcwZ3Rw8uToTV7H9WG2v4d+E9NAPvj7R56oS9+Tyvc8G8pPsDWdjqsBO7Eb4fu23QYw
2024-01-17 01:34:37929 [💬][AuthController.swift 381:25] -> code_challenge: s1lmdwy8n1N1KpCK7dQ7oM2_qbVbdNjFGyt_xhkXg2c
2024-01-17 01:34:38062 [💬][AuthController.swift 139:25] -> 카카오톡 실행: kakaokompassauth://authorize?response_type=code&client_id=b0736cf7617005e4973342e6e3c221cd&redirect_uri=kakaob0736cf7617005e4973342e6e3c221cd://oauth&headers=%7B%22KA%22:%22sdk%5C/2.15.0%20sdk_type%5C/swift%20os%5C/ios-16.6%20lang%5C/ko-KR%20res%5C/375x812%20device%5C/iPhone%20origin%5C/com.infovine.MoneyMoa%20app_ver%5C/02.00.02%22%7D&params=%7B%22code_challenge_method%22:%22S256%22,%22code_challenge%22:%22s1lmdwy8n1N1KpCK7dQ7oM2_qbVbdNjFGyt_xhkXg2c%22%7D
2024-01-17 01:34:41989 [💬][Api.swift 127:29] -> ===================================================================================================
2024-01-17 01:34:41990 [💬][Api.swift 128:29] -> session: 
 type: Auth


2024-01-17 01:34:41993 [ℹ️][Api.swift 129:29] -> request: 
 method: HTTPMethod(rawValue: "POST")
 url:https://kauth.kakao.com/oauth/token
 headers:nil
 parameters: Optional(["ios_bundle_id": "com.infovine.MoneyMoa", "code": "NmM59csKBZdbijsVYr0_GBVWqCJc6gYIrD6XzjahqpXh_m0VauwPudGLsIAKPXObAAABjRWzMjjNsk3jZ7dWzg", "grant_type": "authorization_code", "code_verifier": "GU6jTwQWJKqmJTNNoPrgcwZ3Rw8uToTV7H9WG2v4d+E9NAPvj7R56oS9+Tyvc8G8pPsDWdjqsBO7Eb4fu23QYw", "redirect_uri": "kakaob0736cf7617005e4973342e6e3c221cd://oauth", "client_id": "b0736cf7617005e4973342e6e3c221cd"]) 


2024-01-17 01:34:41995 [ℹ️][Api.swift 130:41] -> response:
 Optional({
    "access_token" = "ICBp4kpPIe2GA8bLr4yyz5cO08zMXV5-wnIKPXObAAABjRWzMxykJA3lYdtGWQ";
    "expires_in" = 43199;
    "refresh_token" = "0Wxi02rb6oqrCma5RNIH9fkJmSCx_rrB4_EKPXObAAABjRWzMxmkJA3lYdtGWQ";
    "refresh_token_expires_in" = 5183999;
    scope = "profile_image profile_nickname";
    "token_type" = bearer;
})


2024-01-17 01:34:42000 [💬][Properties.swift 23:21] -> save-plain : {length = 272, bytes = 0x7b227265 66726573 68546f6b 656e4578 ... 223a3433 3139397d }
2024-01-17 01:34:42004 [💬][Properties.swift 25:21] -> save-crypted : {length = 288, bytes = 0xcca63cb9 5c8614f3 9b99d00c 61d6cf6f ... 2f68d9b2 e505d443 }
"loginWithKakaoTalk() success."
2024-01-17 01:34:42080 [💬][Api.swift 127:29] -> ===================================================================================================
2024-01-17 01:34:42080 [💬][Api.swift 128:29] -> session: 
 type: AuthApi


2024-01-17 01:34:42082 [ℹ️][Api.swift 129:29] -> request: 
 method: HTTPMethod(rawValue: "GET")
 url:https://kapi.kakao.com/v2/user/me
 headers:nil
 parameters: Optional(["secure_resource": true]) 


2024-01-17 01:34:42082 [ℹ️][Api.swift 130:41] -> response:
 Optional({
    "connected_at" = "2024-01-08T05:33:00Z";
    id = 3261680085;
    "kakao_account" =     {
        "email_needs_agreement" = 1;
        "has_email" = 0;
        profile =         {
            "is_default_image" = 1;
            nickname = "\Uc544\Uc774\Ud3f0x";
            "profile_image_url" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_640x640.jpg";
            "thumbnail_image_url" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_110x110.jpg";
        };
        "profile_image_needs_agreement" = 0;
        "profile_nickname_needs_agreement" = 0;
    };
    properties =     {
        nickname = "\Uc544\Uc774\Ud3f0x";
        "profile_image" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_640x640.jpg";
        "thumbnail_image" = "https://k.kakaocdn.net/dn/1G9kp/btsAot8liOn/8CWudi3uy07rvFNUkk3ER0/img_110x110.jpg";
    };
})


"사용자에게 추가 동의를 받아야 합니다."
2024-01-17 01:34:42112 [💬][Api.swift 127:29] -> ===================================================================================================
2024-01-17 01:34:42113 [💬][Api.swift 128:29] -> session: 
 type: Auth


2024-01-17 01:34:42113 [ℹ️][Api.swift 129:29] -> request: 
 method: HTTPMethod(rawValue: "POST")
 url:https://kauth.kakao.com/api/agt
 headers:nil
 parameters: Optional(["access_token": "ICBp4kpPIe2GA8bLr4yyz5cO08zMXV5-wnIKPXObAAABjRWzMxykJA3lYdtGWQ", "client_id": "b0736cf7617005e4973342e6e3c221cd"]) 


2024-01-17 01:34:42113 [ℹ️][Api.swift 130:41] -> response:
 Optional({
    agt = "TN_Q2FiT3Exb4Olnv1Ql7B4CY7yrc-fPrWMUKQo9c5sAAAGNFbMzow";
})


2024-01-17 01:34:42118 [💬][AuthController.swift 466:21] -> code_verifier: GdIBNlcIdtq6DgFHCQDUKw0ul0TiRpsCe57Up16lmUT/x5pIznXCuXPPQuxJoZt29hnuKZ3V0SL9ew/6khGnng
2024-01-17 01:34:42119 [💬][AuthController.swift 469:25] -> code_challenge: RO2EfiXQvLYvUFa_-6g74hP3E9JJAvli8-SDnKb1_uU
2024-01-17 01:34:42119 [💬][AuthController.swift 301:21] -> 
===================================================================================================
2024-01-17 01:34:42120 [💬][AuthController.swift 302:21] -> request: 
 url:https://kauth.kakao.com/oauth/authorize?client_id=b0736cf7617005e4973342e6e3c221cd&ka=sdk/2.15.0%20sdk_type/swift%20os/ios-16.6%20lang/ko-KR%20res/375x812%20device/iPhone%20origin/com.infovine.MoneyMoa%20app_ver/02.00.02&code_challenge_method=S256&redirect_uri=kakaob0736cf7617005e4973342e6e3c221cd://oauth&scope=account_email&response_type=code&code_challenge=RO2EfiXQvLYvUFa_-6g74hP3E9JJAvli8-SDnKb1_uU&agt=TN_Q2FiT3Exb4Olnv1Ql7B4CY7yrc-fPrWMUKQo9c5sAAAGNFbMzow

2024-01-17 01:34:42127 [‼️][AuthController.swift 236:33] -> An error occurred on executing authentication session.
 reason: related decl 'e' for ASWebAuthenticationSessionErrorCode(_nsError: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=3 "The UIWindowScene for the returned window was not in the foreground active state." UserInfo={NSDebugDescription=The UIWindowScene for the returned window was not in the foreground active state.})
2024-01-17 01:34:42128 [💬][AuthController.swift 191:33] -> top vc: SnsLoginViewController
2024-01-17 01:34:42128 [💬][AuthController.swift 203:37] -> top vc: SnsLoginViewController
KakaoSDKCommon.SdkError.ClientFailed(reason: KakaoSDKCommon.ClientFailureReason.Unknown, errorMessage: Optional("An error occurred on executing authentication session."))
2024-01-17 13:35:12.188301+0900 EveryMoney[4210:1713400] [tcp] tcp_input [C9.1.1:3] flags=[R] seq=2566356141, ack=0, win=0 state=LAST_ACK rcv_nxt=2566356141, snd_una=1113800703
2024-01-17 13:35:12.189628+0900 EveryMoney[4210:1713400] [tcp] tcp_input [C9.1.1:3] flags=[R] seq=2566356141, ack=0, win=0 state=CLOSED rcv_nxt=2566356141, snd_una=1113800703

안녕하세요.
iOS 에서 제공하는 기본 브라우저를 사용하여 계정 로그인이 진행 됩니다.
기본 브라우저의 콜백의 경우 이를 호출하는 뷰가 계속 살아 있어야 하는데요

SnsLoginViewController 가 먼저 종료되는 것으로 보입니다.
이점 확인 부탁드리며

코드에서 카카오톡 으로 로그인 후, scope 확인 뒤, 계정 로그인을 시도하고 계시는데요
이렇게 달리 진행하고자 하시는 이유가 없다면 동일하게 톡으로 로그인 시도 하시는게 좋을것 같습니다.

안녕하세요

최초 사용자 (이메일,닉네임,프로필이미지 제공 동의 안한상태)에서도 스코프 확인이 필요 없는것인가요?

그럼 코드를 아래와 같이 수정해도 문제가 없는지요?

    func useKakao() {
        // 카카오톡 실행 가능 여부 확인
        if (UserApi.isKakaoTalkLoginAvailable()) {
            UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in
                    if let error = error {
                        debugPrint(error)
                        Base.sharedInstance.Output_Alert(title: "알림", message: error.localizedDescription, text: "확인")
                    }
                    else {
                        debugPrint("loginWithKakaoTalk() success.")
                        
                        UserApi.shared.me() { (user, error) in
                            if let error = error {
                                debugPrint(error)
                                Base.sharedInstance.Output_Alert(title: "알림", message: error.localizedDescription, text: "확인")
                            }
                            else {
                                
                                if let user = user {
                                    
                                    debugPrint("사용자의 추가 동의가 필요하지 않습니다.")
                                    guard let kakaoEmail = user.kakaoAccount?.email else { return }
                                    guard let profile_image  = user.properties?["profile_image"] else { return }
                                    guard let nickName  = user.properties?["nickname"] else { return }
                                    guard let token = oauthToken?.accessToken else { return }
                                    guard let profile_image_url  = URL(string: profile_image) else { return }
                                    
                                    debugPrint("\(String(describing: kakaoEmail))")
                                    debugPrint("\(String(describing: profile_image))")
                                    debugPrint("\(String(describing: nickName))")
                                    debugPrint("\(String(describing: token))")
                                    debugPrint("\(String(describing: profile_image_url))")
                                    
                                    self.delegate?.result(socialType: snsLoginType.kakaoType, email: kakaoEmail, snsAccessToken: token, name: nickName, profileImg: profile_image_url)
                                    
//                                    var scopes = [String]()
//                                
//                                    
//                                    if (user.kakaoAccount?.emailNeedsAgreement == true) { scopes.append("account_email") }
//                                    
//                                    if (user.kakaoAccount?.profileNicknameNeedsAgreement == true) { scopes.append("profile_nickname") }
//                                    
//                                    if (user.kakaoAccount?.profileImageNeedsAgreement == true) { scopes.append("profile_image") }
//                                    
//                                    if scopes.count > 0 {
//                                        debugPrint("사용자에게 추가 동의를 받아야 합니다.")
//                                        //scope 목록을 전달하여 카카오 로그인 요청
//                                        UserApi.shared.loginWithKakaoAccount(scopes: scopes) { (_, error) in
//                                            if let error = error {
//                                                debugPrint(error)
//                                                // 2024.01.08 kakaoLogin 에러 wifi일 경우 An error occurred on executing authentication session.
//                                                Base.sharedInstance.Output_Alert(title: "알림", message: error.localizedDescription, text: "확인")
//                                            }
//                                            else {
//                                                UserApi.shared.me() { (user, error) in
//                                                    if let error = error {
//                                                        debugPrint(error)
//                                                    }
//                                                    else {
//                                                        
//                                                        guard let kakaoEmail = user?.kakaoAccount?.email else { return }
//                                                        guard let profile_image  = user?.properties?["profile_image"] else { return }
//                                                        guard let nickName  = user?.properties?["nickname"] else { return }
//                                                        guard let token = oauthToken?.accessToken else { return }
//                                                        guard let profile_image_url  = URL(string: profile_image) else { return }
//                                                        
//                                                        debugPrint("\(String(describing: kakaoEmail))")
//                                                        debugPrint("\(String(describing: profile_image))")
//                                                        debugPrint("\(String(describing: nickName))")
//                                                        debugPrint("\(String(describing: token))")
//                                                        debugPrint("\(String(describing: profile_image_url))")
//                                                        
//                                                        self.delegate?.result(socialType: snsLoginType.kakaoType, email: kakaoEmail, snsAccessToken: token, name: nickName, profileImg: profile_image_url)
//                                                     
//                                                    }
//                                                }
//                                            }
//                                        }
//                                    }
//                                    else {
//                                        debugPrint("사용자의 추가 동의가 필요하지 않습니다.")
//                                        guard let kakaoEmail = user.kakaoAccount?.email else { return }
//                                        guard let profile_image  = user.properties?["profile_image"] else { return }
//                                        guard let nickName  = user.properties?["nickname"] else { return }
//                                        guard let token = oauthToken?.accessToken else { return }
//                                        guard let profile_image_url  = URL(string: profile_image) else { return }
//                                        
//                                        debugPrint("\(String(describing: kakaoEmail))")
//                                        debugPrint("\(String(describing: profile_image))")
//                                        debugPrint("\(String(describing: nickName))")
//                                        debugPrint("\(String(describing: token))")
//                                        debugPrint("\(String(describing: profile_image_url))")
//                                        
//                                        self.delegate?.result(socialType: snsLoginType.kakaoType, email: kakaoEmail, snsAccessToken: token, name: nickName, profileImg: profile_image_url)
//                                        
//                                    }
                                }
                            }
                        }
                    }
                }
            
            

        } else {
            Base.sharedInstance.Output_Alert(title: "알림", message: "카카오톡을 설치 후 실행해주세요", text: "확인")
        }
    }

안녕하세요.

스코프 확인이 필요하신 이유가 어떻게 되실까요?
해당 항목들이 필수 설정되어 있다면, 카카오 로그인 시 받드시 동의 받기 때문에 동의 여부를 확인 하실 필요 없습니다.

안녕하세요
저희 앱에서 이메일, 프로필 이미지, 닉네임, 토큰을 사용하고 있어서 스코프로 확인을 했습니다.

동의 항목은 아래 스샷과 같습니다.

현재 카카오계정(이메일)은 선택 동의로 설정 되어있는데 만약 필수로 설정한다면 기존 사용자에게 영향은 없는지요?

선택 동의에서 필수 동의로 변경하게 되면 카카오 로그인 시, 동의받지 않은 사용자에게는 자동으로 해당 항목 동의 화면이 노출됩니다.