2
我試圖獲得與用戶授權令牌如下:DotNetOpenAuth RequestUserAuthorization回調
public static void RequestAuthorization(WebConsumer consumer)
{
if (consumer == null) throw new ArgumentNullException("consumer");
Uri callback = new Uri("http://www.ihighfive.com/"); //test url until app is external
var extraParams = new Dictionary<string, string> {
//need to pass this as extra, but leave the value blank
{ "oauth_token", string.Empty}
};
var req = consumer.PrepareRequestUserAuthorization(callback, extraParams, null);
consumer.Channel.Send(req);
}
但我收到回一個錯誤:
{ "error": { "message" : "oauth_callback is required", "isFriendly" : false} }
如果我修改了上面的代碼並手動包括oauth_callback paramater我得到更多有利結果
var extraParams = new Dictionary<string, string> {
//need to pass this as extra, but leave the value blank
{ "oauth_token", string.Empty},
{ "oauth_callback", "http://www.ihighfive.com/" },
};
因此,通過ca .PrepareRequestUserAuthorization()的llback參數似乎不包含帶請求的oauth_callback。我以某種方式錯誤地使用回調參數?
- 編輯 -
進一步的調查表明,如果ServiceProviderDescription設置爲ProtocolVersion.V10是沒有得到包括oauth_callback參數。如果它設置爲ProtocolVersion.V10a,或者根本沒有設置,則oauth_callback包含在請求中。
[DotNetOpenAuth Expected IProtocolMessage message]可能的重複(http://stackoverflow.com/questions/9233943/dotnetopenauth-expected-iprotocolmessage-message) – 2012-02-11 23:57:51
這些問題都試圖與同一端點交談,但我認爲他們可能是單獨的問題。 – 2012-02-13 14:02:45