java - 401 Unauthorized Error using HttpURLConnection Android? -
we have searched , searched , still cannot seem resolution issue. have rest web service , trying access our android app. web service url work when accessed web browser or advanced rest client extension in chrome. our url looks like:
http://10.52.1.1:8080/gpservice/tenants(name=defaulttenant)/companies(fabrikam,%20inc.)/items(128%20sdram).json and once typed browser prompted credentials. after credentials entered, json result returned.
in our android app trying following:
authenticator.setdefault(new authenticator() { protected passwordauthentication getpasswordauthentication() { return new passwordauthentication("domain\\user", "password".tochararray()); } }); url url = new url(urlstring); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setdooutput(false); conn.setdoinput(true); conn.setrequestmethod("get"); conn.setconnecttimeout(60000); inputstream istream = conn.getinputstream(); any ideas doing wrong? tried different methods, similar connecting remote url requires authentication using java , http://www.muneebahmad.com/index.php/archives/127 no success @ all, getting 401 unauthorized error.
as per comment received: our service using ntlm authentication.
thanks help!
Comments
Post a Comment