title: 401 With Indy IdHttp Digest Authentication in Delphi XE
body: <p>Trying to do a get() with Digest to a partner's web service with Delphi XE.  </p>
  
  <p>I have included <code>IdAuthenticationDigest</code> to the uses clause which should automatically work from what I've read - but I must be missing something because I'm getting a 401 Unauthorized.  </p>
  
  <p>Code:</p>
  
  <pre><code>begin
    // Init request:   
    IdHttp := TIdHttp.Create(nil);
    try
      idHttp.Request.ContentType := self.inputType; // 'application/xml'
      idHttp.Request.Accept := self.outputType; //'application/json';
  
      // Set request method:
      idHttp.Request.Method := Method; // 'Get'
      // Set username and password:
      idHttp.Request.BasicAuthentication := False;
      // IdHttp.Request.Username/Password also fails
      IdHttp.Request.Authentication.Username := 'xx';
      IdHttp.Request.Authentication.password := 'xx';
  
      IdHttp.Request.ContentLength := Length(Body);
  
      // Send request:
      if Method = 'GET' then
        Result := idHttp.Get(self.ServiceHost + URI)
      else
      if Method = 'POST' then
        Result := idHttp.Post(self.ServiceHost + URI, SendStream);
  
     finally
      idHttp.Free;
     end;
  end;
  </code></pre>