tags:

views:

74

answers:

1

I'm using a Cocoa WebView object and I'd like to suppress the authentication dialog that pops down when the user types in the wrong credentials. The server is sending back a Www-Authenticate response header which I believe is triggering the dialog.

Can I somehow intercept this header before it triggers the authentication challenge? Or is there some other way to disable the challenge dialog?

+3  A: 

Take a look at the WebResourceLoadDelegate. It has a method webView:resource:didReceiveAuthenticationChallenge:fromDataSource: that you can implement to intercept those WWW-Authenticate responses. Just make sure you call setResourceLoadDelegate: on your WebView to give it your delegate class where that method is implemented.

Marc W
Wow, that was fast! I see that method, but I don't know what to do to actually disable the dialog.
sam
Ok, so what I did was I implemented the method and then canceled the challenge with:[[challenge sender] cancelAuthenticationChallenge:challenge] and that seems to work.
sam
Excellent. =) I'm glad that helped you find the solution you needed.
Marc W