Jsoup connection with basic access authentication
Is there a way in Jsoup to load a document from a website with basic access authentication? With HTTP basic access authentication you need to send the Authorization header along with a value of "Basic " + base64encode("username:password") . E.g. (with little help of Apache Commons Codec Base64 ): String username = "foo"; String password = "bar"; String login = username + ":" + password; String base64login = new String(Base64.encodeBase64(login.getBytes())); Document document = Jsoup .connect("http://example.com") .header("Authorization", "Basic " + base64login) .get(); // ... (explicit