Hey everyone. Did anyone face an issue with redire...
# ktor
m
Hey everyone. Did anyone face an issue with redirects in KMP? on android when i call an api that returns 307 it automatically redirects me and the call is successful (200). but on IOS i get 401 because the bearer token is getting dropped for some reason while redirecting.
I'm trying to handle a 307 redirect response in Ktor, but I'm struggling to intercept the response correctly. I found a solution on StackOverflow suggesting the implementation of a redirect delegate and reattaching the header values. However, I'm not sure how to apply this in Ktor. I found this solution on stackoverflow https://stackoverflow.com/questions/55024711/401-response-when-calling-a-307-redirect-server How can I implement a redirect delegate in Ktor to intercept a 307 response and reattach header values to the request? Any code examples or guidance would be greatly appreciated.
actual val _client_: HttpClient get() = HttpClient(Darwin.create { val delegate = _KtorNSURLSessionDelegate_() val sessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration val session = NSURLSession.sessionWithConfiguration(sessionConfiguration) usePreconfiguredSession(session = session, delegate = delegate) }) after adding these is there anything else i need to do to disable embedded redirects in IOS? since using followRedirects = false has no effect for some reason