2

I am currently building an android/ios mobile application with kotlin multiplatform compose. This application uses a django server for it's backend. The server has some self signed certificates that block me from doing request through https. Http request are working great, but I need https to test on external devices and also for when the app is going to be deployed. I use OkHttp and darwin for my ktor HttpClient engine. I'm new to mobile dev/kotlin and feeling a bit lost

I have tried following the documentation present on ktor for setting up ssl (https://ktor.io/docs/client-ssl.html), but I don't understand what I'm supposed to do. I have my certificate, but it isn't in a keystore and I don't know how to store it in one. I have also tried following this tutorial (https://alistairsykes.medium.com/how-to-trust-all-ssl-certificates-with-kmm-and-ktor-8f686aec0d09) to trust all certificate as a test. I wasn't able to make it work.

0

1 Answer 1

0

https://github.com/sergiocasero/kmm_mtls_sample

check it out. Try use

HttpClientProvider
expect class HttpClientProvider {
    fun clientWithMtls(block: HttpClientConfig<*>.() -> Unit): HttpClient
    fun client(block: HttpClientConfig<*>.() -> Unit): HttpClient
}
Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.