카카오 로그인 응답시간 지연 문의

카카오 로그인시 카톡으로 이동하여 인증 진행 후 돌아왔을 때 이전화면에서 인디케이터 애니메이션이 멈추고 응답시간이 10초정도 발생하는 문제입니다 SDK는 최신버전으로 사용중입니다.

SwiftUI 기반으로 작성되었으며, 개발 문서의 설명에 따라 info.plist, scheme 설정 완료 후 handleOpenUrl() 함수를 AppDelegate, SceneDelegate 모두에 작성하는방식, 각각 한쪽에 작성하는 방식(SDK Sample 앱 방식) 모두 동일하게 10초가량의 응답시간 지연이 발생하며, 몇몇기기에서는 튕기는 현상도 발생합니다.

아래는 로그입니다

2021-10-06 16:51:26665 [:speech_balloon:][AuthController.swift 373:21] → code_verifier: r822H2+FpnXX/W7Yq39bfpXVCys+uFi5FxUwahV4s5og4NLeDYDWSscD9MKjdA+op+xNoTTvLyUbe9LBAdwk0Q
2021-10-06 16:51:26666 [:speech_balloon:][AuthController.swift 376:25] → code_challenge: KIhQgly6oCogS2FYrT1nLZAdDCjYusLMd-ecUVRb-ms
2021-10-06 16:51:26705 [:speech_balloon:][AuthController.swift 111:25] → 카카오톡 실행: kakaokompassauth://authorize?response_type=code&headers=%7B%22KA%22:%22sdk%5C/2.8.1%20sdk_type%5C/swift%20os%5C/ios-15.0.1%20lang%5C/ko-KR%20res%5C/375x812%20device%5C/iPhone%20origin%5C/kr.weggle.weggle%20app_ver%5C/1.1.8%22%7D&redirect_uri={NATIVE APP KEY}://oauth&client_id=2664642c634c02575274801cdf7df49b&params=%7B%22code_challenge%22:%22KIhQgly6oCogS2FYrT1nLZAdDCjYusLMd-ecUVRb-ms%22,%22code_challenge_method%22:%22S256%22%7D
2021-10-06 16:51:27.106513+0900 Weggle[10598:2242301] [] __nwlog_err_simulate_crash simulate crash already simulated “nw_hash_table_apply called with null table”
2021-10-06 16:51:27.106614+0900 Weggle[10598:2242301] [] nw_hash_table_apply called with null table, dumping backtrace:
[arm64] libnetcore-2736.12.1
0 libnetwork.dylib 0x000000018256a9c0 __nw_create_backtrace_string + 120
1 libnetwork.dylib 0x0000000181ce487c nw_hash_table_apply + 2808
2 libnetwork.dylib 0x000000018226c1e4 D810C689-1339-3FC6-96E8-196B9901E4DC + 6300132
3 libnetwork.dylib 0x0000000182269cc0 D810C689-1339-3FC6-96E8-196B9901E4DC + 6290624
4 CFNetwork 0x0000000181a15ff4 _CFURLStorageSessionCopyIdentifier + 20652
5 libnetwork.dylib 0x0000000181e09da4 D810C689-1339-3FC6-96E8-196B9901E4DC + 1703332
6 libdispatch.dylib 0x00000001070c8a20 _dispatch_call_block_and_release + 32
7 libdispatch.dylib 0x00000001070ca700 _dispatch_client_callout + 20
8 libdispatch.dylib 0x00000001070d4e34 _dispatch_workloop_invoke + 2960
9 libdispatch.dylib 0x00000001070dffa0 _dispatch_workloop_worker_thread + 916
10 libsystem_pthread.dylib 0x00000001f14651b0 _pthread_wqthread + 288
11 libsystem_pthread.dylib 0x00000001f1464f50 start_wqthread + 8
{NATIVE APP KEY}://oauth?code=wcbK85MRNiLfn42x2J9g80a08DD6ymK1SPM07VDQ6Ys-OmhNe6LB-wyHq8oTlw5zkAJ1hwopcJ8AAAF8VJX6VQ
wcbK85MRNiLfn42x2J9g80a08DD6ymK1SPM07VDQ6Ys-OmhNe6LB-wyHq8oTlw5zkAJ1hwopcJ8AAAF8VJX6VQ
2021-10-06 16:51:27976 [:speech_balloon:][Api.swift 116:29] → ===================================================================================================
2021-10-06 16:51:27979 [:speech_balloon:][Api.swift 117:29] → session:
type: Auth

2021-10-06 16:51:27981 [:information_source:][Api.swift 118:29] → request:
method: HTTPMethod(rawValue: “POST”)
url:https://kauth.kakao.com/oauth/token
headers:nil
parameters: Optional([“ios_bundle_id”: “kr.weggle.weggle”, “code”: “wcbK85MRNiLfn42x2J9g80a08DD6ymK1SPM07VDQ6Ys-OmhNe6LB-wyHq8oTlw5zkAJ1hwopcJ8AAAF8VJX6VQ”, “redirect_uri”: “{NATIVE APP KEY}://oauth”, “client_id”: “2664642c634c02575274801cdf7df49b”, “grant_type”: “authorization_code”, “code_verifier”: “r822H2+FpnXX/W7Yq39bfpXVCys+uFi5FxUwahV4s5og4NLeDYDWSscD9MKjdA+op+xNoTTvLyUbe9LBAdwk0Q”])

2021-10-06 16:51:27982 [:information_source:][Api.swift 119:41] → response:
Optional({
“access_token” = “TbzyAIb0Iaq5SykhrMwKhLQpdk38IyDuvOh-mgopcNEAAAF8VJX70w”;
“expires_in” = 43199;
“refresh_token” = “irL_Qh2wnK-vZYxNe_Mx_6BsjiwOceRg_O6P-QopcNEAAAF8VJX70g”;
“refresh_token_expires_in” = 5183999;
scope = “account_email profile story_permalink”;
“token_type” = bearer;
})

code //// Optional(“wcbK85MRNiLfn42x2J9g80a08DD6ymK1SPM07VDQ6Ys-OmhNe6LB-wyHq8oTlw5zkAJ1hwopcJ8AAAF8VJX6VQ”)
2021-10-06 16:51:37695 [:speech_balloon:][Properties.swift 32:21] → load-crypted : {length = 272, bytes = 0x7b6ff4ee a6e0774d 16f4cff5 374b818d … bbb8afdc 06916e4d }
2021-10-06 16:51:37709 [:speech_balloon:][Properties.swift 34:21] → load-plain : {length = 263, bytes = 0x7b227265 66726573 68546f6b 656e4578 … 223a3433 3139397d }
2021-10-06 16:51:37711 [:speech_balloon:][Auth.swift 43:17] → >>>> [KakaoSDKCommon.SessionType.AuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Api: Alamofire.Session, KakaoSDKCommon.SessionType.RxAuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Auth: Alamofire.Session]
2021-10-06 16:51:37712 [:speech_balloon:][MigrateManager.swift 20:17] → ============================================================================================================
2021-10-06 16:51:37712 [:speech_balloon:][MigrateManager.swift 21:17] → check migration…
2021-10-06 16:51:37712 [:speech_balloon:][MigrateManager.swift 23:21] → pass migration…
2021-10-06 16:51:37712 [:speech_balloon:][MigrateManager.swift 24:21] → used sdk version:2.8.1
2021-10-06 16:51:37713 [:speech_balloon:][Properties.swift 22:21] → save-plain : {length = 263, bytes = 0x7b227265 66726573 68546f6b 656e4578 … 223a3433 3139397d }
2021-10-06 16:51:37727 [:speech_balloon:][Properties.swift 24:21] → save-crypted : {length = 272, bytes = 0x7b6ff4ee a6e0774d 16f4cff5 374b818d … 3f4f4237 c61d8479 }
wegglenaverlogin://thirdPartyLoginResult?version=2&code=1
1
2021-10-06 16:51:38010 [:speech_balloon:][Api.swift 116:29] → ===================================================================================================
2021-10-06 16:51:38010 [:speech_balloon:][Api.swift 117:29] → session:
type: AuthApi

2021-10-06 16:51:38011 [:information_source:][Api.swift 118:29] → request:
method: HTTPMethod(rawValue: “GET”)
url:https://kapi.kakao.com/v2/user/me
headers:nil
parameters: Optional([“secure_resource”: true])

2021-10-06 16:51:38012 [:information_source:][Api.swift 119:41] → response:
Optional({
“connected_at” = “2021-07-26T06:44:23Z”;
id = 1822684686;
“kakao_account” = {
email = {EMAIL}
“email_needs_agreement” = 0;
“has_email” = 1;
“is_email_valid” = 1;
“is_email_verified” = 1;
profile = {
“is_default_image” = 0;
nickname = “\Uac15\Uac74”;
“profile_image_url” = “https://k.kakaocdn.net/dn/bcWE9k/btq9JNxZW8K/SeIF7UL4KXO60DI9AZwpXk/img_640x640.jpg”;
“thumbnail_image_url” = “https://k.kakaocdn.net/dn/bcWE9k/btq9JNxZW8K/SeIF7UL4KXO60DI9AZwpXk/img_110x110.jpg”;
};
“profile_needs_agreement” = 0;
};
properties = {
nickname = “\Uac15\Uac74”;
“profile_image” = “https://k.kakaocdn.net/dn/bcWE9k/btq9JNxZW8K/SeIF7UL4KXO60DI9AZwpXk/img_640x640.jpg”;
“thumbnail_image” = “https://k.kakaocdn.net/dn/bcWE9k/btq9JNxZW8K/SeIF7UL4KXO60DI9AZwpXk/img_110x110.jpg”;
};
})

https://devtalk.kakao.com/t/swift-kakao-me-response/112589?u=weggletech

이 글과 동일한 문제로 예상되는데 해결방법이 달려있지 않아 글을 올려봅니다 확인 부탁드립니다

{

안녕하세요.

https://developers.kakao.com/docs/latest/ko/sdk-download/ios

샘플앱 실행하셔서 증상이 동일한지 확인해보시겠어요?

샘플앱에서는 발생하지 않으며, 샘플앱과 동일하게 AppDelegate에서 KakaoSDKCommon.initSDK 와
if (AuthApi.isKakaoTalkLoginUrl(url)) {
return AuthController.handleOpenUrl(url: url, options: options)
}
작성 후 동작시에는 UIApplicationSceneManifest 사용하는 상황이라 AppDelegate에서 사용하는 방식이 안되는것 같습니다 샘플에서 사용하는 AppDelegate 단독 방식에서는 인증이 되지 않습니다.

저도 같은현상 겪고있는데 해결하셨나요? :sob:

네이버 로그인을 같이 사용하시나요?
네이버 로그인 같이 사용하시는 분들이 주로 같은 오류를 겪고 있는 것 같은데
저는 scene delegate 의 수정하니 해결되었습니다.
수정하여 해결 성공한 코드 첨부드립니다.

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    if let url = URLContexts.first?.url {
        if (AuthApi.isKakaoTalkLoginUrl(url)) {
            _ = AuthController.handleOpenUrl(url: url)
        } else {
            NaverThirdPartyLoginConnection
              .getSharedInstance()?
              .receiveAccessToken(URLContexts.first?.url)
            
        }
    }
}
3개의 좋아요

덕분에 저도 해결되었습니다 감사합니다