Skip to content


Subversion checkout URL

You can clone with
Download ZIP
An OAuth Consumer and Provider implemented for .Net
Latest commit f6cf5e5 @bittercoder Merge pull request #28 from flashcurd/master
Exposed the CallbackUri property via the IOAuthSession interface


DevDefined.OAuth logo


The DevDefined.OAuth project is a library for creating both OAuth consumers and providers on the .Net Framework. It currently targets the .Net Framework 3.5 and above, and is written in C#.

What is OAuth

The definition (from wikipedia) is:

OAuth is an open protocol that allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their username and password.

OAuth provides a standardised way to handle delegated Authentication through a series of exchanges, called an authentication flow:

OAuth authentication flow

What's supported

The DevDefined.OAuth library currently supports building consumers (clients) and providers (servers) for both OAuth 1.0 and 1.0a.

The library is designed to be used in both web applications and thick client apps.

Quick Consumer Example

X509Certificate2 certificate = TestCertificates.OAuthTestCertificate();

string requestUrl = "";
string userAuthorizeUrl = "";
string accessUrl = "";
string callBackUrl = "";

var consumerContext = new OAuthConsumerContext
    ConsumerKey = "",
    SignatureMethod = SignatureMethod.RsaSha1,
    Key = certificate.PrivateKey

var session = new OAuthSession(consumerContext, requestUrl, userAuthorizeUrl, accessUrl)
    .WithQueryParameters(new { scope = "" });

// get a request token from the provider
IToken requestToken = session.GetRequestToken();

// generate a user authorize url for this token (which you can use in a redirect from the current site)
string authorizationLink = session.GetUserAuthorizationUrlForToken(requestToken, callBackUrl);

// exchange a request token for an access token
IToken accessToken = session.ExchangeRequestTokenForAccessToken(requestToken);

// make a request for a protected resource
string responseText = session.Request().Get().ForUrl("").ToString();

Additional Resources

OAuth Resources

DevDefined OAuth Resources




You can download releases from the google code site.

Something went wrong with that request. Please try again.