我如何连接到OAuth的在C#中?连接到、OAuth

2023-09-06 17:49:36 作者:嘶喑甜言

对于一个项目,我想创建一个不使用令牌消费的作用。

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

我已成功地创建了code-背后所需的详细信息:

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?

推荐答案

您的第一站应该是的OAuth规范。这正好说明了每个步骤是。如果你想使用 DotNetOpenAuth (易最完整的OAuth库.NET)的OAuth的例子中,我included一个在这里。

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.

在DotNetOpenAuth源$ C ​​$ C还含有实例连接到Facebook,Twitter和谷歌。

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