유니티2020 에디터에서 카카오SDK 로그인 시 System.Collections.Generic.KeyNotFoundException

유니티2020 에디터에서 카카오SDK 로그인 시

다음과 같은 에러가 발생합니다.

CreateCurrentIdpProfile

단계에서 발생하며,

신규 App ID 에서만 발생하는 것 같습니다.

기존에 서비스중인 다른 App ID, App Secret, JavaScript Key를 넣으면 정상적으로 로그인이 됩니다.

원인이 궁금합니다.

감사합니다.

AuthInfo : {"access_token":"5RV2vxrCdoxechIA3NXRR77rEFa-Ii0owAitcAopcJ8AAAF5Wtw2iQ","token_type":"bearer","refresh_token":"5ULtQLuG54yu0g6yL4lOI79w6dVg1-BIB05osQopcJ8AAAF5Wtw2hw","expires_in":7199,"scope":"talk_message profile friends","refresh_token_expires_in":5183999}
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> accessToken : 5RV2vxrCdoxechIA3NXRR77rEFa-Ii0owAitcAopcJ8AAAF5Wtw2iQ, refreshToken : 5ULtQLuG54yu0g6yL4lOI79w6dVg1-BIB05osQopcJ8AAAF5Wtw2hw
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> KGKakaoRequest::RequestMyProfile - false
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> KGKakaoRequest::RequestMyProfile
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> KGWWW::Request - https://kapi.kakao.com/v2/user/me
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][1]</color> <color=cyon>[ENTER]</color> NZAsyncManager::RunAsync
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][666]</color> Bytes Length : 4
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][1]</color> <color=cyon>[LEAVE]</color> NZAsyncManager::RunAsync
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][666]</color> Content-Type : application/json
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][666]</color> <color=cyon>[ENTER]</color> NZAsyncManager::QueueOnMainThread
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][666]</color> <color=cyon>[LEAVE]</color> NZAsyncManager::QueueOnMainThread
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][1]</color> <color=cyon>[ENTER]</color> OnUpdate Action:System.Action
<color=green>[2021-05-11 PM 6:57:34][VERBOSE][1]</color> Response body - {"id":1727607934,"has_signed_up":false,"kakao_account":{"profile_needs_agreement":false,"profile":{"nickname":"(LT)","is_default_image":true}}}
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> {"id":1727607934,"has_signed_up":false,"kakao_account":{"profile_needs_agreement":false,"profile":{"nickname":"(LT)","is_default_image":true}}}
<color=yellow>[2021-05-11 PM 6:57:34][DEBUG][1]</color> CreateCurrentIdpProfile
**System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.**



  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <695d1cc93cca45069c528c15c9fdd749>:0 

  at Kakaogame.Impl.KGKakaoProfile.CreateCurrentIdpProfile (System.String accessToken, System.String refreshToken, System.Collections.Generic.Dictionary`2[TKey,TValue] profileDic) [0x00155] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Unity.KGKakaoLoginUI.ProcRequestMe (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] myProfile) [0x0004a] in <67f701ab63dc4885bb34f250c9098332>:0 

  at Kakaogame.Impl.Unity.KGKakaoLoginUI+<>c.<RequestMyProfile>b__22_0 (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] myProfile) [0x00001] in <67f701ab63dc4885bb34f250c9098332>:0 

  at Kakaogame.Impl.Kakao.KGKakaoRequest+<>c__DisplayClass11_0.<RequestMyProfile>b__1 (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] contents) [0x00001] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZWWW+<>c__DisplayClass8_0.<Request>b__0 (System.Int32 code, System.String body) [0x000a1] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZWWW+<>c__DisplayClass7_2.<_Request>b__4 () [0x00021] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZAsyncManager.OnUpdate () [0x0002f] in <a3af30f04f4248068aa913b5bdddb687>:0 
UnityEngine.Debug:LogError (object) (at ?)
Kakaogame.SDK.KGApplication/<>c:<CreateSdkObject>b__18_0 (Kakaogame.Base.KGDebug/LogLevel,string) (at ?)
Kakaogame.Base.KGDebug:Exception (System.Exception) (at ?)
Kakaogame.Impl.Common.NZAsyncManager:OnUpdate () (at ?)
Kakaogame.Impl.Internal.NZLifecycleListener:OnUpdate () (at ?)
Kakaogame.Impl.Internal.NZLifecycleListener:Notify (Kakaogame.Impl.Internal.NZLifecycleEvent) (at ?)
Kakaogame.SDK.Internal.InterfaceBrokerNative/InterfaceBrokerNativeObject:Update () (at ?)

[성공]

{"id":1727224012,"has_signed_up":false,"kakao_account":{"profile_needs_agreement":false,"profile":{"nickname":"AAA(LT)","is_default_image":true},"has_ci":false,"ci_needs_agreement":true,"service_user_id":106136719520981282}}

[실패]

{"id":1727607934,"has_signed_up":false,"kakao_account":{"profile_needs_agreement":false,"profile":{"nickname":"AAA(LT)","is_default_image":true}}}

응답받은 kakao_account 에서 아래 Key 가 없네요

has_ci
ci_needs_agreement
service_user_id

안녕하세요.

두앱의 필수동의 설정이 일치하는지 확인 부탁드려요~

내 애플리케이션>제품 설정>카카오 로그인>동의항목

has_ci
ci_needs_agreement

권한부여 후에도 동일한 에러현상 발생하고 있습니다.

유니티2020 에디터에서 카카오SDK 로그인 시

CreateCurrentIdpProfile 단계에서

dictionary 의 KeyNotFoundException 에러가 발생하는 원인과 해결 방법을 알고 싶습니다.

<color=yellow>[2021-05-13 PM 6:50:29][DEBUG][1]</color> CreateCurrentIdpProfile
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.


  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <695d1cc93cca45069c528c15c9fdd749>:0 

  at Kakaogame.Impl.KGKakaoProfile.CreateCurrentIdpProfile (System.String accessToken, System.String refreshToken, System.Collections.Generic.Dictionary`2[TKey,TValue] profileDic) [0x00155] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Unity.KGKakaoLoginUI.ProcRequestMe (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] myProfile) [0x0004a] in <67f701ab63dc4885bb34f250c9098332>:0 

  at Kakaogame.Impl.Unity.KGKakaoLoginUI+<>c.<RequestMyProfile>b__22_0 (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] myProfile) [0x00001] in <67f701ab63dc4885bb34f250c9098332>:0 

  at Kakaogame.Impl.Kakao.KGKakaoRequest+<>c__DisplayClass11_0.<RequestMyProfile>b__1 (Kakaogame.Impl.NZResult result, System.Collections.Generic.Dictionary`2[TKey,TValue] contents) [0x00001] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZWWW+<>c__DisplayClass8_0.<Request>b__0 (System.Int32 code, System.String body) [0x000a1] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZWWW+<>c__DisplayClass7_2.<_Request>b__4 () [0x00021] in <a3af30f04f4248068aa913b5bdddb687>:0 

  at Kakaogame.Impl.Common.NZAsyncManager.OnUpdate () [0x0002f] in <a3af30f04f4248068aa913b5bdddb687>:0 
UnityEngine.Debug:LogError (object) (at ?)
Kakaogame.SDK.KGApplication/<>c:<CreateSdkObject>b__18_0 (Kakaogame.Base.KGDebug/LogLevel,string) (at ?)
Kakaogame.Base.KGDebug:Exception (System.Exception) (at ?)
Kakaogame.Impl.Common.NZAsyncManager:OnUpdate () (at ?)
Kakaogame.Impl.Internal.NZLifecycleListener:OnUpdate () (at ?)
Kakaogame.Impl.Internal.NZLifecycleListener:Notify (Kakaogame.Impl.Internal.NZLifecycleEvent) (at ?)
Kakaogame.SDK.Internal.InterfaceBrokerNative/InterfaceBrokerNativeObject:Update () (at ?)

[실패]

{"id":1727607934,"has_signed_up":false,"kakao_account":{"profile_needs_agreement":false,"profile":{"nickname":"AAA(LT)","is_default_image":true},"has_ci":false,"ci_needs_agreement":true}}

참고로, service_user_id 는 아래 공지에 따라 추가하지 않았습니다.

[공지] v1 ‘사용자 정보 요청’ API 종료

기존 서비스 앱ID와 신규 앱ID 알려주시겠어요?

추가로 로직내에 사용하고 계신 Dictionary에 Key값이 없는 상황 같은데요.
어떤 키값이 존재하지 않는지 확인하고 사용하시면 될 것같습니다.

기존 앱ID 57003
신규 앱ID 577037

Dictionary 는 아래 SDK 에서 사용하고 있어서
어떤 Key값이 없는지 알 수 없는 상황입니다.
Kakaogame.Impl.KGKakaoProfile.CreateCurrentIdpProfile

감사합니다.

네, 확인 감사합니다. SDK에서 발생하는 오류였군요.

우선 앱간의 동의 설정과 프로필 조회가 모두 정상 리턴되는 것을 확인했습니다.

해당 SDK는 디벨로퍼스에서 제공하는 SDK가 아닌데요,
카카오게임즈에서 제공하는 SDK를 사용중이시라면 카카오 게임즈에 문의 부탁드려요.

빠른답변 감사합니다

좋아요 1