【问题标题】:400 Bad request when using DotNetOpenAuth使用 DotNetOpenAuth 时出现 400 错误请求
【发布时间】:2015-08-18 21:03:09
【问题描述】:

我正在使用 DotNetOpenAuth 在我的本地系统中实现 OAuth。每次我收到以下错误:+

ex.InnerException   {"The remote server returned an error: (400) Bad Request."} System.Exception {System.Net.WebException}

下面是我的代码sn-p

  AuthorizationServerDescription authServer = new AuthorizationServerDescription()
{
    TokenEndpoint = new Uri(TOKEN_ENDPOINT),
    AuthorizationEndpoint = new Uri(AUTHZ_ENDPOINT),
};

                string[] scopes = new string[] { "Scope" };
                var client = new WebServerClient(authServer , "ClientId", "Client_Secret");


                var token= client.ExchangeUserCredentialForToken("username", "password");

当调用 client.ExchangeUserCredentialForToken 时,我收到错误消息。无法弄清楚发生了什么错误。可能的原因是什么?

【问题讨论】:

    标签: c# oauth https oauth-2.0 dotnetopenauth


    【解决方案1】:

    您没有在请求中提供范围尝试将其添加到最后一个参数:

    client.ExchangeUserCredentialForToken("username", "password", scopes);
    

    【讨论】:

      猜你喜欢
      • 2013-09-27
      • 2015-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-08
      • 2016-08-25
      • 1970-01-01
      相关资源
      最近更新 更多