I have upgraded my project to Phonegap 1.4 to Cordova 1.8.1. Ajax call to webservice was working fine with 401 Unauthorized , when I am passing invalid username / password in Phonegap 1.4.
After up gradation it is not working , I am not getting any response and web service stay there.
If change code to Phonegap 1.4 , it starts working.
Please help
I've had this problem for the last couple months and finally figured it out.
First of all, the temporary workaround that we used was to implement a timeout period on the request. That worked, but the response was always a 404. We didn't know if it actually failed authentication, or if our services were down. Not an acceptable workaround for our system.
Finally, after MUCH googling, I found the actual problem.
When a 401 gets returned, (which is a Basic Authentication, authentication failure), it adds a header to the response, called "WWW-Authenticate". This tells the browser to prompt the user to try and login. iOS webview doesn't know what to do with that, so that's why the application hangs.
From your service, all you need to do is remove the WWW-Authenticate header, and you should start to see the 401's in your error function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With