Skip to content

Instantly share code, notes, and snippets.

@sunieldalal
Created July 27, 2015 17:34
Show Gist options
  • Select an option

  • Save sunieldalal/53685063b5631a0fbc28 to your computer and use it in GitHub Desktop.

Select an option

Save sunieldalal/53685063b5631a0fbc28 to your computer and use it in GitHub Desktop.
Base64 username/pasword example
//Reference: http://ostermiller.org/utils/Base64.html
URL url = new URL("http://....");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty(
"Authorization",
"Basic " + Base64.encode(
username + ":" + password
)
);
InputStream in = connection.getInputStream();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment