Return error when basic auth challenge fails
Fix iOS 7 deprecations