-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Describe the bug?
When using the Okta Kotlin Mobile SDK (IDX SDK), I encountered a kotlinx.serialization.MissingFieldException. The exception indicates that the field key is required for type com.okta.idx.kotlin.dto.v1.Message.Localization, but it is missing in the response payload.
Error Trace:
kotlinx.serialization.MissingFieldException: Field 'key' is required for type with serial name 'com.okta.idx.kotlin.dto.v1.Message.Localization',
but it was missing at path: $.remediation.value[0].value[0].form.value[3].messages.value[0].i18n
suspend fun proceed( remediation: IdxRemediation ): HashMap<String, Any> { try { when (val resumeResult = flow.proceed(remediation)) { is OAuth2ClientResult.Error -> { val exceptionText = resumeResult.exception.toString() val displayMessage = if (exceptionText.contains("MissingFieldException")) { "MissingFieldException" } else { exceptionText } return resultantMap( displayMessage, NativeResponseParams.failure, NativeResponseParams.codeOktaError ) } is OAuth2ClientResult.Success -> { lastRemediationResponse = resumeResult.result return handleResponse(resumeResult.result) } } } catch (e: Exception) { return resultantMap( "${Strings.exception}$e", NativeResponseParams.failure, NativeResponseParams.codeCatchError ) } }
Steps to Reproduce:
Call flow.proceed(remediation) with a remediation that triggers an error response.
Observe the exception thrown when SDK attempts to deserialize the response.
Expected Behavior:
SDK should gracefully handle missing fields in the Message.Localization object without throwing MissingFieldException.
Actual Behavior:
SDK throws MissingFieldException when the key field is missing in the response payload.
It should return success with respective error message
Environment:
Okta Kotlin Mobile SDK (IDX SDK)
kotlinx.serialization
Android/Kotlin project
What is expected to happen?
SDK should gracefully handle missing fields in the Message.Localization object without throwing MissingFieldException.
What is the actual behavior?
SDK throws MissingFieldException when the key field is missing in the response payload.
It should return success with respective error message
Reproduction Steps?
Call flow.proceed(remediation) with a remediation that triggers an error response.
Observe the exception thrown when SDK attempts to deserialize the response.
Additional Information?
No response
SDK Version and Artifact(s) used.
Okta Kotlin Mobile SDK (IDX SDK)
kotlinx.serialization
Android/Kotlin project
Build Information
No response