cauliframework / cauli

Debug Networking
https://cauli.works
MIT License
28 stars 5 forks source link

Cauli prevents http auth (with AlamoFireImage) from working #121

Closed Shukuyen closed 5 years ago

Shukuyen commented 5 years ago

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:

// In Appdelegate.swift:
_ = Cauli.shared

// In your ViewController:
@import AlamoFireImage

// Set basic auth data to be used by AlamoFireImage
ImageDownloader.default.addAuthentication(user: "MyUser", password: "MyPassword")

// Load the image
imageView.af_setImage(withURL: imageUrl, placeholderImage: nil, filter: nil, progress: nil, progressQueue: DispatchQueue.main, imageTransition: UIImageView.ImageTransition.noTransition, runImageTransitionIfCached: false) { response in
    print(response.result)
}
brototyp commented 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:

I think the first option is the best here, but I will continue to Digg a bit.

brototyp commented 5 years ago

@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.

Shukuyen commented 5 years ago

@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 commented 5 years ago

@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.

Shukuyen commented 5 years ago

After reinstalling the pod and cleaning the project the bugfix branch fixes the issue!

brototyp commented 5 years ago

After reinstalling the pod and cleaning the project the bugfix branch fixes the issue!

Lovely. Thanks for the update!