Closed Shukuyen closed 5 years ago
Thank you for this bug report! I had the assumption that there might be this kind of bugs.
Current state of my debugging:
I see two ways:
Catch the challenge in the Protocol by implementing func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
. This way we already have the URLAuthenticationChallenge
. But this way we have to keep a reference to the completion handler to call it.
Catch the challenge by inspecting the first HTTPURLResponse
, searching for a WWW-Authenticate
header and create our own URLAuthenticationChallenge
.
I think the first option is the best here, but I will continue to Digg a bit.
@Shukuyen Thanks again for your bug report. I think I found one way of proxy-ing the Auth Challenges. Can you do me a favor and try the bugfix/121-http-basic-auth-is-skipped
in your project? I am not 100%ly sure if this works with AlamoFire/AlamoFireImage.
@brototyp I am afraid the fix does not work in my project. Still the same issue (image requests return a 401 status code, the authentication block is ignored).
@brototyp I am afraid the fix does not work in my project. Still the same issue (image requests return a 401 status code, the authentication block is ignored).
Alright. Good to know. I will try to get a setup running using AlamoFireImage
and an image requires HTTP Basic Authorization.
After reinstalling the pod and cleaning the project the bugfix branch fixes the issue!
After reinstalling the pod and cleaning the project the bugfix branch fixes the issue!
Lovely. Thanks for the update!
Repro:
Expected result: Image will display correctly
Actual result: Image is not displayed, the response contains a 401 status code. Without Cauli it works fine.
Example code: