PKCE validation failed. transformed code verifier does not match code challenge. code_verifier: code_challenge: 코드 어디있나요

ClientFailed(reason: KakaoSDKCommon.ClientFailureReason.Cancelled, errorMessage: Optional(“The KakaoTalk authentication has been canceled by user.”))
2022-10-31 04:11:29267 [:speech_balloon:][Api.swift 122:29] → ===================================================================
2022-10-31 04:11:29268 [:speech_balloon:][Api.swift 123:29] → session:
type: Auth
2022-10-31 04:11:29270 [:information_source:][Api.swift 124:29] → request:
method: HTTPMethod(rawValue: “POST”)
url:https://kauth.kakao.com/oauth/token
headers:nil
parameters: Optional([“client_id”: “네이티브키”, “redirect_uri”: “kakao네이티브키://oauth”, “grant_type”: “authorization_code”, “ios_bundle_id”: “앱번들아이디”, “code_verifier”: “TYvvz1DHZKbKt23FGoZ8Lqakzcv/0Bfcsd4IRPBEfuTuxNgxNxgM3IcU1PPSawpDCngUwYH+04mlVOZi25zjsA”, “code”: “AxPCcmW8UCzIfPl5BbhQV-FDz_JF7blSkj-53w3hH1hTHG11d8uidtdN26nNZJ2AXeipWQo9dVsAAAGELOGHfQ”])
2022-10-31 04:11:29270 [:information_source:][Api.swift 125:41] → response:
Optional({
error = “invalid_grant”;
"error_code" = KOE313;
**“error_description” = "**The KakaoTalk authentication has been canceled by user. transformed code verifier does not match code challenge.";
*})
AuthFailed(reason: KakaoSDKCommon.AuthFailureReason.InvalidGrant, errorInfo: Optional(KakaoSDKCommon.AuthErrorInfo(error: KakaoSDKCommon.AuthFailureReason.InvalidGrant, errorDescription: Optional("[quote=“kds0914, post:1, topic:125867, full:true”]
ClientFailed(reason: KakaoSDKCommon.ClientFailureReason.Cancelled, errorMessage: Optional(“The KakaoTalk authentication has been canceled by user.”))
2022-10-31 04:11:29267 [:speech_balloon:][Api.swift 122:29] → ===================================================================
2022-10-31 04:11:29268 [:speech_balloon:][Api.swift 123:29] → session:
type: Auth
2022-10-31 04:11:29270 [:information_source:][Api.swift 124:29] → request:
method: HTTPMethod(rawValue: “POST”)
url:https://kauth.kakao.com/oauth/token
headers:nil
parameters: Optional([“client_id”: “네이티브키”, “redirect_uri”: “kakao네이티브키://oauth”, “grant_type”: “authorization_code”, “ios_bundle_id”: “앱번들아이디”, “code_verifier”: “TYvvz1DHZKbKt23FGoZ8Lqakzcv/0Bfcsd4IRPBEfuTuxNgxNxgM3IcU1PPSawpDCngUwYH+04mlVOZi25zjsA”, “code”: “AxPCcmW8UCzIfPl5BbhQV-FDz_JF7blSkj-53w3hH1hTHG11d8uidtdN26nNZJ2AXeipWQo9dVsAAAGELOGHfQ”])
2022-10-31 04:11:29270 [:information_source:][Api.swift 125:41] → response:
Optional({
error = “invalid_grant”;
"error_code" = KOE313;
**“error_description” = "**The KakaoTalk authentication has been canceled by user. transformed code verifier does not match code challenge.";
*})
*AuthFailed(reason: KakaoSDKCommon.AuthFailureReason.InvalidGrant, errorInfo: Optional(KakaoSDKCommon.AuthErrorInfo(error: KakaoSDKCommon.AuthFailureReason.InvalidGrant, errorDescription: Optional(“PKCE validation failed. transformed code verifier does not match code challenge.”))))

다른 댓글 보니까 요청할때 불필요한

code_verifier: code_challenge: 를 빼라고 하시는데 이것을 어디서 빼는지 전혀 이해를 못하겠습니다.
요청할때 파라미터 넘겨주는게 없는데 어디 사이트가서 제외 신청을 하는건지
xcode 에서는 단순한게 UserApi.shared.loginWithKakaoTalk() 코드만 실행시키는데
저 2개 파라미터는 어디에 있는건지 모르겠습니다 알려주세요
[/quote]

*"))))

다른 댓글 보니까 요청할때 불필요한

code_verifier: code_challenge: 를 빼라고 하시는데 이것을 어디서 빼는지 전혀 이해를 못하겠습니다.
요청할때 파라미터 넘겨주는게 없는데 어디 사이트가서 제외 신청을 하는건지
xcode 에서는 단순한게 UserApi.shared.loginWithKakaoTalk() 코드만 실행시키는데
저 2개 파라미터는 어디에 있는건지 모르겠습니다 알려주세요

안녕하세요.

확인을 위해 앱 ID 부탁드립니다.


앱ID
https://developers.kakao.com/ 의 내 애플리케이션>앱 설정>요약 정보 : 기본정보에 있는 앱 ID
숫자로된 ID 입니다

ex) 123456

Hi woody.ho, I got same issue can you also help to check for me. This is my app id 791720

@publogad
Please tell me the API name you used.
ex, UserApi.shared.loginWithKakaoTalk()

@woody.ho
안녕하세요 같은 오류가 발생하고 있습니다

앱 id:731262

@woody.ho
동일한 오류 발생입니다.
앱 id: 572496

에러 녹화본.MP4.zip (2.7 MB)

@jjj1211 안녕하세요.

podfile.lock 파일 내용 제공 부탁드립니다.
가능하신경우 오류 발생 시, 로그도 같이 부탁드립니다.

cocoapods는 사용하지 않고 있고, 3rd-Party용 swift package에 kakao-ios-sdk dependency를 추가하여 사용하고 있습니다.

카카오 로그인 코드는 다음과 같이 작성했고

if UserApi.isKakaoTalkLoginAvailable() {
    UserApi.shared.loginWithKakaoTalk(completion: { [weak self] oauthToken, error in
        guard let self else { return }

        // get kakao profile data...
    })
}

카카오 로그인 시도 시 로그는 다음과 같습니다.

2023-09-04 03:19:40896 [💬][MigrateManager.swift 21:17] -> ============================================================================================================

2023-09-04 03:19:40898 [💬][MigrateManager.swift 22:17] -> check migration...

2023-09-04 03:19:40899 [💬][MigrateManager.swift 43:17] -> ============================================================================================================

2023-09-04 03:19:40899 [💬][MigrateManager.swift 44:17] -> start migration sdk from v1 to v2....

2023-09-04 03:19:40900 [💬][MigrateManager.swift 68:21] -> first time sdk v2...

2023-09-04 03:19:40902 [💬][MigrateManager.swift 96:17] -> finished migration sdk...

2023-09-04 03:19:40911 [💬][AuthApiCommon.swift 44:17] -> >>>> [KakaoSDKCommon.SessionType.AuthApi: Alamofire.Session, KakaoSDKCommon.SessionType.Api: Alamofire.Session, KakaoSDKCommon.SessionType.Auth: Alamofire.Session, KakaoSDKCommon.SessionType.RxAuthApi: Alamofire.Session]

2023-09-04 03:19:40912 [💬][AuthController.swift 369:21] -> code_verifier: x/40ZCCPbGWPjjlpnqXNyaKwTbfe6rt4EZ4JN+/uS9ptoswUp8IQ32cCHqr6IOQQob+3pIT138bwmzcsabIHtg

2023-09-04 03:19:40912 [💬][AuthController.swift 372:25] -> code_challenge: ViVrkddrl7sYWn2CrgwuPQcT9w8dHQpIGg-BM7AcRTw

2023-09-04 03:19:40914 [💬][AuthController.swift 457:21] -> code_verifier: uXfO/PMeSPWhUPx9q36GFmxWEQM6jPY5nSod/2fig9K9NBfEDDBy/X/3X0QkMSiNMFGi0t879jEBhjz1Web9Vw

2023-09-04 03:19:40914 [💬][AuthController.swift 460:25] -> code_challenge: 0rPr29SYg-zPEurlZjO2-iw9WjTvAApIPAi-kXYY5pU

2023-09-04 03:19:40915 [💬][AuthController.swift 302:21] ->

===================================================================================================

2023-09-04 03:19:40915 [ℹ️][AuthController.swift 303:21] -> request:

url:https://kauth.kakao.com/oauth/authorize?redirect_uri=kakao{클라이언트 ID}://oauth&response_type=code&ka=sdk/2.16.0%20sdk_type/swift%20os/ios-16.6%20lang/ko-KR%20res/375x667%20device/iPhone%20origin/{앱 번들 ID}%20app_ver/1.39.2&code_challenge=0rPr29SYg-zPEurlZjO2-iw9WjTvAApIPAi-kXYY5pU&client_id={클라이언트 ID}&code_challenge_method=S256

2023-09-04 03:19:40969 [ℹ️][AuthController.swift 142:25] -> 카카오톡 실행: kakaokompassauth://authorize?client_id={클라이언트 ID}&headers=%7B%22KA%22:%22sdk%5C/2.16.0%20sdk_type%5C/swift%20os%5C/ios-16.6%20lang%5C/ko-KR%20res%5C/375x667%20device%5C/iPhone%20origin%5C/{앱 번들 ID}%20app_ver%5C/1.39.2%22%7D&redirect_uri=kakao{클라이언트 ID}://oauth&response_type=code&params=%7B%22code_challenge_method%22:%22S256%22,%22code_challenge%22:%22ViVrkddrl7sYWn2CrgwuPQcT9w8dHQpIGg-BM7AcRTw%22%7D

2023-09-04 03:19:41820 [💬][Api.swift 127:29] -> ===================================================================================================

2023-09-04 03:19:41820 [💬][Api.swift 128:29] -> session:

type: Auth

2023-09-04 03:19:41822 [ℹ️][Api.swift 129:29] -> request:

method: HTTPMethod(rawValue: "POST")

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

headers:nil

parameters: Optional(["redirect_uri": "kakao{클라이언트 ID}://oauth", "grant_type": "authorization_code", "code_verifier": "uXfO/PMeSPWhUPx9q36GFmxWEQM6jPY5nSod/2fig9K9NBfEDDBy/X/3X0QkMSiNMFGi0t879jEBhjz1Web9Vw", "code": "94V_Nx2rjAu5o1IWVg0CNEjJ8h5gf8IdbYskZ-gAK8eZMdWyEDleeN3znEMnDk7VlGV2qwoqJVIAAAGKXtjNBQ", "client_id": "{클라이언트 ID}", "ios_bundle_id": "{앱 번들 ID}"])

2023-09-04 03:19:41822 [ℹ️][Api.swift 130:41] -> response:

Optional({

error = "invalid_grant";

"error_code" = KOE313;

"error_description" = "PKCE validation failed. transformed code verifier does not match code challenge.";

})

로그에서는 loginWithKakaoTalk, loginWithKakaoAccount 가 동시에 사용되는 것 처럼 표시되는데요
loginWithKakaoAccount 사용하고 계시다면 디버깅을 통해 동시에 호출되는지 확인 부탁드립니다.

1개의 좋아요

답변 감사합니다. 정확히 말씀해주신 문제가 있었네요.