c# - DotNetOpenAuth 的 DesktopConsumer ProcessUserAuthorization 中的验证器是什么?

标签 c# oauth dotnetopenauth

我是 DotNetOpenAuth 的新手,我找不到在 ProcessUserAuthorization 中用作验证器的值。

我想要实现的是使用我的用户凭据登录到使用 OAuth 的应用程序(称为 UserVoice)。这是我的代码的样子:

string requestToken;
var authorizeUri = consumer.RequestUserAuthorization(new Dictionary<string, string>(), null, out requestToken).AbsoluteUri;
var verifier = "???";
var accessToken = consumer.ProcessUserAuthorization(requestToken, verifier).AccessToken;
consumer.PrepareAuthorizedRequest(endpoint, accessToken, data).GetResponse();

我尝试使用我的用户名、我的密码、我的消费者 key 、我的消费者 secret ,但似乎没有任何效果。有人知道我应该使用哪个值作为验证者吗?

谢谢

最佳答案

我终于找到了一种使用 DotNetOpenAuth 登录 UserVoice 的方法。我认为 UserVoice 的 OAuth 实现不是标准的,但我能够在这期间做到:

var consumer = new DesktopConsumer(this.GetInitialServiceDescription(), this._manager)
string requestToken;
consumer.RequestUserAuthorization(null, null, out requestToken);

// get authentication token
var extraParameters = new Dictionary<string, string>
{
    { "email", this._email },
    { "password", this._password },
    { "request_token", requestToken },
};

consumer = new DesktopConsumer(this.GetSecondaryServiceDescription(), this._manager);
consumer.RequestUserAuthorization(extraParameters, null, out requestToken);

其中 GetInitialServiceDescription 返回良好的请求描述,而 GetSecondaryServiceDescription 是一个被黑的版本并返回授权端点代替请求 token 端点。以这种方式返回的“request_token”(根据我对 OAuth 的理解,这并不是一个真正的普通 request_token)然后可以用作 PrepareAuthorizedRequest 的访问 token 。

关于c# - DotNetOpenAuth 的 DesktopConsumer ProcessUserAuthorization 中的验证器是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11020951/

相关文章:

asp.net-mvc - Facebook、Google OAuth 在 Azure 上有时会失败

authentication - 什么是端点?

c# - 我应该使用 basicHttpBinding 还是 WsHttpBinding 来创建安全的 Java 客户端?

c# - 学习 System.Speech API 的好资源是什么?

c# - 在 windows azure 上找不到路径的一部分

python - getUser 返回 EDAMSystemException errorCode=8

c# - 如何为 DotNetOpenAuth 编写 VB 或 C# GUI 客户端?

.net - IAuthenticationRequest.RedirectToProvider 不应该返回,但它确实

openid - 已超过允许完成身份验证的最长时间

c# - TabPage 作为用户控件?