Hello everyone, I'm having an issue with cookie m...
# ktor
j
Hello everyone, I'm having an issue with cookie management on a native project. I use
AcceptAllCookiesStorage()
as
CookiesStorage
on my httpClient. To remove cookies when logging out from our app, we invalidate all the cookies by updating their expiring date. Just like this :
Copy code
fun CookiesStorage.invalidateCookies(url: URL) {
    val invalidatedCookies = get(url).map { it.copy(expires = GMTDate(timestamp = -1)) }
    invalidatedCookies.forEach { cookie -> addCookie(url, cookie) }
}
It works on Android but not on iOS. After spending some times on the subject, I noticed that the cookies on the CookiesStorage are always empty. But when I do the requests on my app, I do have cookies. I did succeeded to found where the cookies were stored but I couldn't delete or invalidate them. To sum up :
AcceptAllCookiesStorage().get(url).count()
=> 0 cookies (doesn't work)
httpClient.cookies(url).count()
=> 3 cookies (works but can't update them) Is this a known problem or did I do something wrong ?
a
I guess the problem is that the underlying Darwin HTTP client manages cookies on its own. Can you please file an issue with a complete code snippet to reproduce the problem?