DotNetOpenAuth预期的IProtocolMessage消息

编程入门 行业动态 更新时间:2024-10-09 00:45:40
本文介绍了DotNetOpenAuth预期的IProtocolMessage消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试请求身份验证令牌:

I'm trying to request an authentication token:

public static void RequestAuthorization(WebConsumer consumer) { var extraParams = new Dictionary<string, string> { { "oauth_token", string.Empty}, { "oauth_callback", "www.ihighfive/" }, }; var req = consumer.PrepareRequestUserAuthorization(callback, extraParams, null); consumer.Channel.Send(req); }

问题是,当我运行.PrepareRequestUserAuthorization()时,出现以下错误

Problem is, when I run .PrepareRequestUserAuthorization() I get the following error

预期的IProtocolMessage消息,但未收到可识别的消息。

Expected IProtocolMessage message but received no recognizable message.

用Fiddler检查请求/响应,我可以看到响应返回(混淆值):

Inspecting the request/response with Fiddler, I can see that the response returns(values obfusticated):

{ "oauth_token" : "this-is-the-oauth-token", "oauth_token_secret" : "this-is-the-oauth-secret-token", "oauth_callback_confirmed" : true, "urlToSendUserTo" : "blah.blah/api/OAuthAuthorizeToken.aspx?oauth_token=token-value-is-really-long"}

对我来说,这似乎是一个不错的选择。如果我访问urlToSendUserTo,它将起作用,然后将我传递到我的初始回调URL。因此,我想DNOA在解析响应时遇到问题,但我看不出为什么。

To me, this appears to be a good response. If I visit the urlToSendUserTo, it works, and then passes me through to my initial callback url. So I guess DNOA is having problems parsing the response, but I can't see why.

推荐答案

服务器使用的协议是什么?它不是OAuth 1.0,而是您在DotNetOpenAuth中使用OAuth 1.0类。 OAuth 1.0要求,该响应位于 application / x中-www-form-urlencoded 格式,但在您的响应摘要中,它显然是JSON。

What protocol is the server using? It's not OAuth 1.0 but you're using OAuth 1.0 classes in DotNetOpenAuth. OAuth 1.0 mandates that the response be in application/x-www-form-urlencoded format but in your snippet of the response it's clearly in JSON instead.

此外,我从未见过 urlToSendUserTo 参数在任何规范中,我不知道您为什么要发送空的 oauth_token 作为额外参数

Also, I've never seen the urlToSendUserTo parameter in any spec, and I don't know why you're sending an empty oauth_token as an extra parameter in the request.

您和/或服务器使用的语言似乎完全不同。

It seems like you and/or the server are speaking very different languages.

更多推荐

DotNetOpenAuth预期的IProtocolMessage消息

本文发布于:2023-11-25 10:16:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629356.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:消息   DotNetOpenAuth   IProtocolMessage

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!