openAuth协议错误 [英] openAuth protocol error

查看:49
本文介绍了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();
     }

推荐答案

在专门针对图书馆的论坛上讨论DotNetOpenAuth的使用会更好吗?例如此处 [
Wouldn''t be better to discuss the use of DotNetOpenAuth on a forum dedicated to the library?? Such as here[^]???

Honestly, the chances of anyone who has used OpenAuth wandering by your question here are pretty slim.


这篇关于openAuth协议错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆