Authentication error: Unable to respond to any of these challenges: {} Android - 401 Unauthorized
I have taken reference from this link Authentication Error when usi
How come it works from the PhoneGap but not Java. PhoneGap runs the app in a web container and so already has been authenticated - and you have all the right cookies. AJAX will share the same session that and everything 'just works'.
However HTTPClient is a completely different - you are initiating a brand new HTTP session and everything has to be right.
A few comments on how HTTP Auth works:
There are several HTTP authentication methods - and it's the web server that chooses which. Before going any further, check your Drupal configuration to work out whether it is:
(Note also that the web container has the 'smarts' to be able to try different authentication methods as requested by the server, all behind the scenes)
Also check the Drupal web logs. A few pointers:
Let me know if this helps. If not, and you can give more details as per this post, I can follow up with more advice.