本文介绍了openAuth协议错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么会出现openAuth协议错误?
Why do I get openAuth protocol error ?
{"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();
}
推荐答案
这篇关于openAuth协议错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!