A recent project at work lead me to develop a lightweight C# Oauth Consumer class to call an OAuth API from a Microsoft Office addin.

Oauth is “an open protocol to allow secure API authorization in a simple and standard method from desktop and web applications”. A lot of documentation, and the specification, about the OAuth protocol can be found on oauth.net.

I personally read

  1. Twitter’s introduction to Oauth
  2. Lorna Jane Mitchell’s introduction on ThinkVitamin
  3. and glimpsed at the specification on oauth.net a few times

The first thing I did was to look for an existing class on aouth.net but everything seemed to be an overkill for my project so, using the Zend::OAuth package as a guideline for my architecture, I set out to develop my own. A fellow developer also gave me some sample code he used on his own project which included a modified version of Tim Pinkawa‘s OAuthBase.cs class. My thanks to them for their help with this library.

In order to make sharpOauth a valuable library to share with other developers, I wanted to add code samples illustrating its usage. I wrote two

  1. sample1_twitterClient is a code sample for a desktop or mobile application which will use the pincode system to validate the authorization process. I also added in this sample, an example of use of the unique access token provided by twitter when one creates an application to bypass the authorization process.
  2. sample2_twitterWeb is a asp .net web application sample which will prompt twitter, upon valid authorization, to redirect to the callback Url defined in the settings.

I hope the code and samples are documented enough to where anyone can download the library and start using it in his/her own OAuth projects. The library can be found on my GitHub page in the sharpOauth repository. Code away and don’t hesitate to comment or submit improvements to the code.

Filed under: Computing, Development, Dot Net

Tagged with: , , , , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to sharpOauth: lightweight C# OAuth Consumer class

2 Comments to "sharpOauth: lightweight C# OAuth Consumer class"

  1. Comment by Deepak on May 31, 2011 at 8:07 am Reply

    Nice article for OAuth.

    You may also wish to try http://code.google.com/p/socialauth-net/ as well which is out of the blue easy API for OAuth authentication. To use it
    1. Make few changes in .Config
    2. Add few DLL
    3. Call Login() method
    thats it!

  2. Comment by Chariotelevateur.Skynetblogs.Be on September 29, 2012 at 5:40 pm Reply

    Hοwdу! This is my 1st comment hеre so
    I just ωanted to give a quіck shout out and ѕay I
    genuinely enjoy reading your artіcleѕ.

    Can you recommenԁ any other blogѕ/webѕites/forums that cover the same subjесts?
    Thаnks a lot!

Name (required)

Email (required)

Website

Leave a Reply

  • About Me


    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.