title: Jetty HTTP Client Digest Auth
body: <p>I am trying to get authenticated using a Jetty HTTP Client and Digest Auth.</p>
  
  <p>I always get the Exception:</p>
  
  <pre><code>org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
  </code></pre>
  
  <p>Here is my Code:</p>
  
  <pre><code>    HttpClient httpClient = new HttpClient();
  
      httpClient.start();
  
      String realm = "me@kennethreitz.com";
      String user = "user";
      String pass = "passwd";
      URI uri =new URI("http://httpbin.org/digest-auth/auth/user/passwd/MD5");
      AuthenticationStore a = httpClient.getAuthenticationStore();
      a.addAuthentication(
          new DigestAuthentication(uri, realm, user, pass));
  
      ContentResponse response = httpClient
              .newRequest(uri)
              .send();
              //.get(5, TimeUnit.SECONDS);
  
      System.out.println(response);
  </code></pre>
  
  <p>For testing purposes i use a <a href="http://httpbin.org/" rel="nofollow noreferrer">http://httpbin.org/</a> endpoint, but i also tried other endpoints - all unsuccessfully...</p>
  
  <p>Am i missing something or doing wrong?</p>