Digest Authentication WCF Web Api

Topics: Web Api
May 18, 2011 at 3:42 PM


We have a situation where we have a server that communicates through a REST api. This server uses Digest Authentication.
How can we use the WCF Web Api to communicate using Digest? Using the WebClient (not from the api) for this is possible, but
with that we loose the opertunity to use MultipartContent, StreamContent etc, because it excepts only byte[].

Is it possible to use the WCF Web Api for digest authentication?

May 18, 2011 at 9:11 PM
Edited May 18, 2011 at 9:12 PM

Are you asking how to write a client to talk to an existing server requiring Digest authentication or how to write the server-side authentication code from a client supplying the appropriate content in the authorization header?  Either way, the API provides the ability to do both.  Check out my MVC sample (posted by Darrel Miller) in the contrib project for a working sample of Basic authentication or for a quick primer, check out Cibrax's bog post from April.  You should be able to search for both as I don't have the links on hand.  This should get you started for implementing Digest.

May 19, 2011 at 6:22 AM

Hi david,

Tanx for the reply. Basically we are looking for an solution to make a client talk to the server that is requiring Diget authentication. In your sample I only see Basic authentication. And I don't see how can be used in an application. Did you mean that I have to write the Digest implementation myself? The other problem is that we don't have a MVC application but a Windows WPF Application.


May 19, 2011 at 3:14 PM

Yep, in that case you just need to call the service using HttpClient and add an appropriate header.  MVC vs. WPF does not matter in this case.