[英]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? 我从这里去哪里?
Your first stop should be the OAuth specification . 您的第一站应该是OAuth规范 。 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的OAuth示例(这很容易是.NET的最完整的OAuth库),我在这里提供了一个示例。
The DotNetOpenAuth source code also contains examples for connecting to Facebook, Twitter, and Google. DotNetOpenAuth源代码还包含用于连接到Facebook,Twitter和Google的示例。
DOtNetOpenAuth is overly complicated and does not help a beginner to understand the OAuth dialog. DOtNetOpenAuth过于复杂,无法帮助初学者理解OAuth对话框。 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.
对于在客户端使用OAuth的小型项目,让我建议一下RestSharp ,它很简单,不是最好的,但至少您知道自己在做什么。 Here is a sample of code to get you started .
这是使您入门的代码示例 。 I hope this helps !
我希望这有帮助 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.