connection = (HttpURLConnection)new URL(mURL).openConnection();
connection.setRequestMethod("GET");
String basicAuth = params[0] + ":" + params[1];
basicAuth = "Basic " + new String(Base64.encode(basicAuth.getBytes(),Base64.NO_WRAP));
connection.setRequestProperty("Authorization",basicAuth);
connection.connect();
InputStream in = connection.getInputStream();
I have gone through all possible questions based on this on SO but with out any success. I am trying to connect to my server using basic authentication. But when I try to access the input stream from URLConnection
it throws IOException
. Thanks for any help from any one of you.