user1367729
user1367729

Reputation: 33

How do I connect to OAuth in C#?

For a project I am trying to create a consumer role that does not utilise tokens.

I have managed to create the required details in the code-behind:

        string outUrl = "";
    string querystring = "";

    string consumerKey = "";
    string consumerSecret = "";
    Uri uri = new Uri("");

    oAuthBase2 oAuth = new oAuthBase2();
    string nonce = oAuth.GenerateNonce();
    string timeStamp = oAuth.GenerateTimeStamp();

    string sig = oAuth.GenerateSignature(uri, consumerKey, consumerSecret, string.Empty, string.Empty,
        "POST", timeStamp, nonce, oAuthBase2.SignatureTypes.HMACSHA1, out outUrl,
        out querystring);

Where do I go from here?

Upvotes: 1

Views: 4464

Answers (2)

Lewis
Lewis

Reputation: 84

DOtNetOpenAuth is overly complicated and does not help a beginner to understand the OAuth dialog. For a small project using OAuth on the client side, let me suggest RestSharp which is simple, not the best, but at least you know what you're doing. Here is a sample of code to get you started. I hope this helps !

Upvotes: 2

George Stocker
George Stocker

Reputation: 57907

Your first stop should be the OAuth specification. It explains exactly what each step is for. If you want an OAuth example using DotNetOpenAuth (easily the most complete OAuth library for .NET), I've included one here.

The DotNetOpenAuth source code also contains examples for connecting to Facebook, Twitter, and Google.

Upvotes: 3

Related Questions