OAuth C# (very) Basic Library

I know it took me a while (sorry) but I had a couple things on my plate.

At first I wanted to release a more complete integration of OAuth within ASP.NET, but that will have to wait to the next time frame I can allocate to work on this.

In the meantime, there is some basic C# code in the OAuth code repository which generates the OAuth signature, which is the most complicated thing to implement in the spec (not that it’s that difficult to implement :-) It’s actually quite easy).

To use the C# code, simply do this (based on the samples in the spec):

using OAuth;

OAuthBase oauth = new OAuthBase();

Uri url = new Uri(“http://photos.example.net/photos?file=vacation.jpg&size=original”);

string signature = oauth.GenerateSignature(url, “dpf43f3p2l4k3l03”, “kd94hf93k423kf44”, “nnch734d00sl2jdk”, “pfkkdhi9sl3r4s00”, “GET”, oauth.GenerateTimeStamp(), oauth.GenerateNonce(), OAuthBase.SignatureTypes.HMACSHA1);

After that you can concatenate the relevant query parameters as well as the signature value to the URL and use it.

If you have a different timestamp and/or nonce generation method, you can inherit and override these methods.

If you require a different hashing algorithm other than the default HMAC-SHA1 or the PLAINTEXT (which MUST be used with a secure communication channel such as HTTPS) you can use the “GenerateSignatureBase” method to generate the signature base string and then call “GenerateSignatureUsingHash” passing the signature base and the hash algorithm you are using.

That’s about it. I’ll update when I’ll have some more integrative code.

Yedda Twitter .NET / C# Library

This is a bit of shameless promotion but I think it’s worthwhile never the less :-)

One of the things I did lately on my day job (Yedda) was to integrate it with Twitter (check the integration here and add Yedda as your friend!).

Yedda is all about sharing and us sharing things like code with the rest of the world is no exception.

So, without further due, I’m proud to present the Yedda Twitter .NET / C# Library (you will see that it’s more of wrapper than a library… really ;-) ). The post about it in our Dev Blog is here and the details, source and binary are here.

The code is free as in beer and is provided on a “AS IS” basis.

If you have questions about the library, Twitter, C#, .NET, the API, the meaning of life etc, feel free to ask on Yedda.