我爲什麼得到openAuth protocol error
?dotnetOpenAuth在協議錯誤上失敗。它是否是TokenManager的ServiceProviderDescription?
{"The remote server returned an error: (400) Bad Request."}
at System.Net.HttpWebRequest.GetResponse() at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:line 126
public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription
{
RequestTokenEndpoint =
new MessageReceivingEndpoint("https://www.google.com/account/OAuthGetRequestToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest),
UserAuthorizationEndpoint =
new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthAuthorizeToken",
HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest),
AccessTokenEndpoint =
new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetAccessToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest),
TamperProtectionElements =
new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};
public void StartOAuth()
{
var consumer = new WebConsumer(GoogleConsumer.ServiceDescription, new InMemoryTokenManager("user", "pass"));
// Url to redirect to
var authUrl = new Uri("http://www.google.com");
// request access
consumer.Channel.Send(consumer.PrepareRequestUserAuthorization(authUrl, null, null));
throw new NoRedirectToAuthPageException();
}
我仍然在本地主機上運行。試圖改變到一些本地主機的網址,但它沒有幫助。我想使用DNOA,但是我認爲它在http://www.matlus.com/oauth-c-library/ – 2012-03-04 08:59:47
中出現的標題中缺少一些內容,可能的罪魁禍首是更新的答案。 – 2012-03-05 01:32:58